<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	 xmlns:media="http://search.yahoo.com/mrss/" >

<channel>
	<title>ExcelTrick</title>
	<atom:link href="https://exceltrick.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://exceltrick.com</link>
	<description>ExcelTrick - Easy, Smart &#38; Effective!</description>
	<lastBuildDate>Wed, 15 Nov 2023 08:20:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.3.8</generator>
	<item>
		<title>Excel SORT Function – How To Use</title>
		<link>https://exceltrick.com/functions/excel-sort-function/</link>
		
		<dc:creator><![CDATA[Shubhra Jain]]></dc:creator>
		<pubDate>Mon, 30 Oct 2023 07:11:00 +0000</pubDate>
				<category><![CDATA[Functions]]></category>
		<guid isPermaLink="false">https://exceltrick.com/?p=10635</guid>

					<description><![CDATA[The SORT function enables us to easily organize and rearrange the dataset as per our requirements. Using the function, we can quickly reorder the data in ascending or descending order based on one or multiple columns or rows. The SORT function is an essential function when dealing with larger datasets as it simplifies the data [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The SORT function enables us to easily organize and rearrange the dataset as per our requirements. Using the function, we can quickly reorder the data in ascending or descending order based on one or multiple columns or rows.</p>
<p>The SORT function is an essential function when dealing with larger datasets as it simplifies the data by sorting it with defined parameters. New to the stage, the SORT function cannot be found in versions earlier than Excel 2021.</p>
<img decoding="async" fetchpriority="high" class="aligncenter size-full wp-image-10639" src="https://exceltrick.com/wp-content/uploads/2023/10/Excel-SORT-Function.png" alt="Excel SORT Function" width="753" height="396" title="Excel SORT Function – How To Use 16">
<h2>Syntax</h2>
<p>The syntax of the SORT function contains four arguments that ensure that we can rearrange the given dataset as per the specified criteria. The syntax is as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SORT</span>(array,[sort_index],[sort_order],[by_col])</code></div>
<p style="margin: 0px;"><strong>Arguments:</strong></p>
<p>Details of the arguments and their roles are mentioned below.</p>
<p style="padding-left: 30px;">&#39;<em>array</em>&#39; &#8211; This is a mandatory argument that accepts the value of the cell range or array that we wish to sort. The value of the array argument can be a static array, cell reference, or the return value of a function.</p>
<p style="padding-left: 30px;">&#39;<em>sort_index</em>&#39; &#8211; This is an optional argument that indicates the column number or row number that must be used as a basis for sorting the data. If left empty, the default value of the argument is 1 which means the SORT function will sort by the first column or row depending on the input value of the <em>by_col</em></p>
<p style="padding-left: 30px;">&#39;<em>sort_order</em>&#39; &#8211; This is another optional argument that determines the order in which the data should be sorted. When left empty, the value defaults to 1 which rearranges the data in ascending order. When the value is set to -1, the data is sorted in descending order.</p>
<p style="padding-left: 30px;">&#39;<em>by_col</em>&#39; &#8211; This is the last optional argument that accepts Boolean input values. This argument decides whether we want to sort by columns or by rows. By default,<em> by_col</em> is set to FALSE, which means sorting by rows. To rearrange the input data horizontally by columns, the value of the <em>by_col</em> argument should be set to TRUE.</p>
<h2>Important Characteristics of the SORT Function</h2>
<p>The most prominent characteristic of the SORT function is that it is dynamic in nature, which means when the data is altered in the input array, the same is reflected in the return data.</p>
<p>Some other noteworthy features of the SORT function are as follows.</p>
<ul>
<li>When you use the SORT function, it maintains the relationship between data in different columns or rows, ensuring that data stays correctly aligned even after reordering.</li>
<li>If the value of the <em>sort_index</em> argument is out of range, the SORT function returns a <a href="https://exceltrick.com/functions/value-error-excel/">#VALUE error</a>.</li>
<li>The <em>sort_order</em> argument only accepts 1 or -1 as the input value. If we enter any other value, the function throws a #VALUE error.</li>
<li>Only omission or FALSE setting of the <em>by_col</em> argument results in the function sorting by row.</li>
</ul>
<p>Let&#39;s go through some practical examples of the SORT function to learn how it helps us organize and rearrange data.</p>
<h2>Examples of SORT Function</h2>
<p>We know that the utility of the SORT function is to rearrange data based on columns. Let&#39;s delve into a practical example using a sample dataset to further grasp its functionality. Here we have a simple dataset containing names and corresponding scores.</p>
<img decoding="async" class="aligncenter size-full wp-image-10640" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_01.png" alt="Examples of SORT Function" width="405" height="507" title="Excel SORT Function – How To Use 17">
<p>The first instance is a default view of the SORT function where we wish to rearrange the array B2:C5. As the other parameters are left empty, each argument assumes its default value and reorders the data as per the first column in ascending order, sorting by row. We finally have the dataset arranged in alphabetical order of the names.</p>
<p>The next example shows the context of other arguments. The formula takes the data in the cell range B2:C5, sorts it based on the values in the second column (column C) in descending order, and returns the sorted dataset. We finally have the data indicating top scorers to lowest.</p>
<p>With a foundational understanding of the function in place, let&#39;s progress to explore different methods and applications to make the most of it.</p>
<h3>Example 1 &#8211; Simple Use of SORT Function</h3>
<p>Imagine you are a teacher and it&#39;s the end of term. You now have all the students&#39; grades in a dataset that includes their ID, names, and marks scored in three subjects. You now wish to do basic analysis such as finding out the top-performing student or the lowest marks secured in a subject.</p>
<img decoding="async" class="aligncenter size-full wp-image-10641" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_02.png" alt="Simple Use of SORT Function" width="594" height="386" title="Excel SORT Function – How To Use 18">
<p>This is a classic use case of the SORT function. The goal is to rearrange the dataset as per marks scored in Maths. The student with the highest marks in Maths must be on top. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SORT</span>(A1:E11,3,<span class="operator">-</span>1,FALSE)</code></div>
<p>The formula aims to arrange the data in the array A1:E11 based on the marks obtained in maths, indicated by 3 indicating the column number, in descending order.</p>
<img decoding="async" class="aligncenter wp-image-10642 size-full" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_03.png" alt="data in the array based on the marks obtained" width="1035" height="396" title="Excel SORT Function – How To Use 19">
<p>Now that we know who scored the highest marks in maths, let&#39;s move on to finding the lowest marks scored in science. We can again use the SORT function and change the input value of the <em>sort_order</em> argument to 1 indicating the ascending order.</p>
<p>As we wish to sort the dataset based on science marks (Column D), the formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SORT</span>(A2:E11,4,1,FALSE)</code></div>
<img decoding="async" class="aligncenter wp-image-10643 size-full" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_04.png" alt="sort the dataset based on science marks" width="1032" height="401" title="Excel SORT Function – How To Use 20">
<p>Now that we&#39;ve learned how to rearrange a dataset using a single column, it&#39;s important to recognize that when working with extensive data sets, we often require multi-level sorting. In the next example, let&#39;s explore how to use the SORT function to rearrange the dataset by multiple columns in a different order.</p>
<h3>Example 2 &#8211; Multi-level Sorting Using SORT Function</h3>
<p>Imagine a scenario where you are managing a database of job applicants for a company&#39;s recruitment process. The database contains information about applicants, including their names, years of experience, and the department they are applying for.</p>
<p>Now, you want to sort the applicants first by their department in ascending order (alphabetical order) and then, within each department, sort them by years of experience in descending order (from most experienced to least experienced).</p>
<img decoding="async" class="aligncenter size-full wp-image-10644" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_05.png" alt="Multi-level Sorting Using SORT Function" width="512" height="475" title="Excel SORT Function – How To Use 21">
<p>So, to ensure that we are including more than one column, we will use array constants for the input values of the <em>sort_index</em> and <em>sort_order</em> argument. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SORT</span>(A2:C13, {3,2}, {1,<span class="operator">-</span>1})</code></div>
<p>The first value in the array is 3 as column C contains the department they are applying for which will be sorted first. The sorting order for column C is defined in the third argument&#39;s array as 1, indicating ascending order. Next to be sorted is column B (given as 2 in the first array) &#8211; the years of experience, which is to be sorted in descending order (carried out by -1 in the third argument.</p>
<img decoding="async" class="aligncenter wp-image-10645 size-full" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_06.png" alt="dataset sorted with grouped applicants" width="911" height="479" title="Excel SORT Function – How To Use 22">
<p>Now that you have the dataset sorted, you can forward the grouped applicants to the relevant teams.</p>
<h3>Example 3 &#8211; Dynamic Sorting with SORT Function</h3>
<p>Suppose you have downloaded some stock price data to analyze the daily prices of four stocks over a period. The dataset contains rows representing a different stock. Each entry is of the relevant stock&#39;s daily closing price.</p>
<img decoding="async" class="aligncenter size-full wp-image-10646" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_07.png" alt="Dynamic Sorting with SORT Function" width="748" height="183" title="Excel SORT Function – How To Use 23">
<p>We wish to reorder the dataset based on the Stock 2 prices in descending order. As the dataset will be sorted by column, we can set the input value of <em>by_col</em> to TRUE. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SORT</span>(B2:F4,2,<span class="operator">-</span>1,TRUE)</code></div>
<img decoding="async" class="aligncenter wp-image-10647 size-full" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_08.png" alt="reorder the dataset based on the Stock 2 prices in descending order" width="782" height="316" title="Excel SORT Function – How To Use 24">
<p>While the above solution successfully arranges the Stock2 data in descending order, it lacks the flexibility to accommodate additional data for future days. To ensure new data for the next days are automatically adjusted in a sorted manner, we can convert the dataset into Excel tables.</p>
<p>To do so, select the dataset (A2:F4) and click on &#39;<em>Format as Table</em>&#39; on the <em>Home</em> tab. Let&#39;s name it &#39;stockprices&#39;. Now the formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SORT</span>(stockprices,2,<span class="operator">-</span>1,TRUE)</code></div>
<img decoding="async" class="aligncenter wp-image-10648 size-full" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_09.png" alt="combination of the Excel table with the SORT function" width="786" height="279" title="Excel SORT Function – How To Use 25">
<p>As we can see, when an additional column was added for the latest date, the returned dataset dynamically accommodates the new values. Therefore, a combination of the Excel table with the SORT function ensures that your table stays up to date as your dataset evolves.</p>
<h3>Example 4 &#8211; Using SORT Function with FILTER Function</h3>
<p>In this example, you have a large sales data which includes month-wise sales of a product along with the sales quantity and revenue. Your aim is to sort the products based on their total revenue along with the flexibility to choose different months to analyze.</p>
<img decoding="async" class="aligncenter size-full wp-image-10649" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_10.png" alt="Using SORT Function with FILTER Function" width="471" height="468" title="Excel SORT Function – How To Use 26">
<p>We can use the <a href="https://exceltrick.com/functions/excel-filter-function/">FILTER function</a> to select data for a specific month and then sort the products within that month. Let&#39;s take cell G1 where the user can choose the month. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">FILTER</span>(A2:D13, A2:A13<span class="operator">=</span>G1)</code></div>
<p>This will filter the dataset based on the condition that the &quot;Month&quot; column (Column A) should be equal to the value in cell G1. It selects rows where the &quot;Month&quot; matches the value in G1 and returns the corresponding data from columns A to D.</p>
<img decoding="async" class="aligncenter wp-image-10650 size-full" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_11.png" alt="filter the dataset based on the condition" width="737" height="448" title="Excel SORT Function – How To Use 27">
<p>Now we have the data for the intended month, we will sort the data based on the fourth column, which is &quot;Total Revenue,&quot; in descending order (-1). The final formula will be used as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SORT</span>(<span class="function">FILTER</span>(A2:D13, A2:A13<span class="operator">=</span>G1), 4, <span class="operator">-</span>1)</code></div>
<img decoding="async" class="aligncenter wp-image-10651 size-full" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_12.png" alt="month-wise data sorted in descending order based on revenue" width="745" height="448" title="Excel SORT Function – How To Use 28">
<p>We now have the necessary month-wise data sorted in descending order based on revenue. The next day, what if you need to email the top 3 performing products as per the quantity sold? You can do so using the same SORT function combined with the INDEX function. Let&#39;s explore how to do that.</p>
<h3>Example 4.1 &#8211; Using SORT Function with INDEX Function</h3>
<p>As we want the top products based on quality sold, we will use the SORT function to reorder the data based on the values in the third column (column C) in descending order (-1). The SORT function returns a sorted array. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SORT</span>(A2:D13,3,<span class="operator">-</span>1)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10652" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_13.png" alt="Using SORT Function with INDEX Function" width="770" height="430" title="Excel SORT Function – How To Use 29">
<p>The next step is to use the <a href="https://exceltrick.com/functions/excel-index-function/">INDEX function</a> to retrieve the first 3 rows from the sorted dataset. Putting it all together, the formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">INDEX</span>(<span class="function">SORT</span>(A2:D13,3,<span class="operator">-</span>1), <span class="function">SEQUENCE</span>(3), {2,3,4})</code></div>
<p>Specifically, it extracts values from three rows (determined by SEQUENCE(3)) and three columns (determined by {2, 3, 4}) in that sorted range.</p>
<img decoding="async" class="aligncenter wp-image-10653 size-full" src="https://exceltrick.com/wp-content/uploads/2023/10/how-to-use-the-sort-function-in-excel_14.png" alt="extract a sorted value from a specific position" width="861" height="526" title="Excel SORT Function – How To Use 30">
<p>You can also use this logic to extract a sorted value from a specific position.</p>
<p>We now know that the SORT function in Excel is an indispensable tool for efficient data organization and analysis.</p>
<p>Practice to discover more applications of the said function and how you can include it in your daily work. While you improve your data manipulation skills with the SORT function, we will work on yet another Excel function to further add to your knowledge.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Calculate Present Value in Excel (With Examples)</title>
		<link>https://exceltrick.com/how-to/calculate-present-value/</link>
		
		<dc:creator><![CDATA[Mehwish Javaid]]></dc:creator>
		<pubDate>Wed, 11 Oct 2023 06:56:00 +0000</pubDate>
				<category><![CDATA[How To's]]></category>
		<guid isPermaLink="false">https://exceltrick.com/?p=10579</guid>

					<description><![CDATA[Determining the initial cash injection for a target investment, evaluating the better option between two investments, calculating the current worth of an investment. These are all the requirements leading up to wanting to find the present value. Present value is the financial value of a future income stream at the date of valuation. In Excel, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Determining the initial cash injection for a target investment, evaluating the better option between two investments, calculating the current worth of an investment. These are all the requirements leading up to wanting to find the present value. Present value is the financial value of a future income stream at the date of valuation.</p>
<p>In Excel, you will find the PV function is quite the handy present value calculator. The type and nature of investment will however determine the variables for the PV function. The three broad categories we&#39;ll cover for calculating the present value are annuities, perpetuities, and one-time payouts.</p>
<p>Are you confusing present value with net present value? Let&#39;s establish that the two are quite far from equal. How you ask? Read below!</p>
<img decoding="async" class="aligncenter size-full wp-image-10583" src="https://exceltrick.com/wp-content/uploads/2023/10/Calculating-Present-Value-PV-In-Excel.png" alt="How to Calculate Present Value in Excel" width="753" height="396" title="How to Calculate Present Value in Excel (With Examples) 39">
<h2>PV Vs NPV</h2>
<p>Present value is the current value of an investment now with a projected income stream as per the set interest rate. PV is the figure you calculate when you want to compute, for example, the initial amount of investment to be made to achieve a certain target in a given number of years.</p>
<p>Or for computing the amount to be paid now given the interest rate and future payments. The present value calculation assumes fixed interest rates, payments, and intervals between payments. It can also account for different annuity types (end of period or beginning of period payment).</p>
<p>While net present value also signifies a present value, it is indicative of the profitability of an investment. Both PV and NPV incorporate discounted cash flows. What makes NPV a net figure is the adjustment of the initial investment to outline profitability. As opposed to regular cash flow, NPV deals with uneven cash flow. All in all, NPV calculates the present value of net cash flow over a period of time.</p>
<p>Having outlined the distinctions between the two, we can now proceed to explore the methodology for calculating the present value for investments.</p>
<p>Let&#39;s get presenting present values!</p>
<h2>Method #1 – PV Formula of Single Cash Flow</h2>
<p>Let&#39;s start with the least variables and a simple investment concept. This medium calculates the present value of a single payment using the PV function in Excel. The PV function returns the present value figure; the amount that future payments are worth now. To explain the following case example, right now we will just focus on a single instance of a future payment instead of multiple instances.</p>
<p>As an example to carry this out, let&#39;s say Cal is targeting to gather $4,000 for a project in 2 years and another $1,000 by the third year. He finds a couple of investment options and wants to weigh out how much he must initially invest in either option. In other words, this initial investment will be labeled as the present value, and the target figure as the future value of the investment.</p>
<p>This formula is for calculating the present value of a lump sum:</p>
<div class="excelFormula"><code>PV = FV/(1+i)<sup>n</sup></code></div>
<p>And here would be the outcome of this formula:</p>
<img decoding="async" class="aligncenter size-full wp-image-10584" src="https://exceltrick.com/wp-content/uploads/2023/10/caluclating-present-value-in-excel_01.png" alt="PV Formula of Single Cash Flow" width="380" height="220" title="How to Calculate Present Value in Excel (With Examples) 40">
<p>But with Excel, the PV function can do the job. A very simple formula is shown below employing the PV function for the task:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">PV</span>(C3,C4,,C5)</code></div>
<p>The first argument requires the interest/discount rate which we have entered as C3. The second argument, denoting the number of payment periods is fed as 3 years here. The next argument is left blank (you will see its use in the upcoming section) and finally, the future value is entered as the fourth argument.</p>
<p>Just as the general present value formula would operate, the PV function has computed the present value of the first investment option as $4,081 indicating the set-up amount that this choice will require.</p>
<img decoding="async" class="aligncenter wp-image-10585 size-full" src="https://exceltrick.com/wp-content/uploads/2023/10/caluclating-present-value-in-excel_02.png" alt="PV Formula of Single Cash Flow" width="379" height="221" title="How to Calculate Present Value in Excel (With Examples) 41">
<p>Also, note that the resulting value of the PV function is negative from the point of view of the investor. For the issuer, the future value will be entered as negative, deriving a positive present value figure. Nevertheless, you can still have the final figure positive by starting the formula with a minus sign like so:</p>
<div class="excelFormula"><code><span class="operator">=-</span><span class="function">PV</span>(C3,C4,,C5)</code></div>
<h2><img decoding="async" class="aligncenter wp-image-10586 size-full" src="https://exceltrick.com/wp-content/uploads/2023/10/caluclating-present-value-in-excel_03.png" alt="PV Formula of Single Cash Flow" width="379" height="221" title="How to Calculate Present Value in Excel (With Examples) 42"></h2>
<h3>Single Cash Flow with Compound Interest</h3>
<p>The compounding frequency in the previous example was yearly. If Cal was faced with investment options with more frequent compounding, this is how the present value computation would be altered:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">PV</span>(C3<span class="operator">/</span>C4,C5<span class="operator">*</span>C4,,C6)</code></div>
<p>We&#39;ll suppose that the options in the example involve monthly and quarterly compounding respectively which we have incorporated in row 4. The two things in the formula that would be affected by compounding frequency are the interest rate and the number of payment periods.</p>
<p>To be converted into a monthly interest rate, 7% will be divided by 12 (as done in the first argument where C3/C4). Also, the number of periods in 3 years with monthly compounding will be 3 times 12 (reflected in the second argument).</p>
<img decoding="async" class="aligncenter size-full wp-image-10587" src="https://exceltrick.com/wp-content/uploads/2023/10/caluclating-present-value-in-excel_04.png" alt="Single Cash Flow with Compound Interest" width="424" height="240" title="How to Calculate Present Value in Excel (With Examples) 43">
<p>In comparison to $4,081 with yearly compounding, monthly compounding requires $26 less to be invested now.</p>
<h2>Method #2 – PV Formula of Series of Cash Flows (Annuity)</h2>
<p>Next up, we&#39;ll calculate the present value of an annuity in Excel, again courtesy of the PV function. An annuity comprises a series of consistent payments made at regular intervals, whether yearly, quarterly, monthly, weekly, etc. You probably didn&#39;t know them as annuities, but popular examples include home mortgage and pension payments.</p>
<p>Compared to a single payment, two elements of the PV function will come into play with annuities: the <em>pmt</em> and <em>type</em> arguments. <em>pmt</em> takes the periodic payment and <em>type</em> refers to the type of annuity – ordinary or due.</p>
<p>An ordinary annuity has end-of-the-period payments while annuity-due has beginning-of-the-period payments. The difference the type brings to the valuation of the annuity is that with annuity-due, each payment is compounded for one extra period.</p>
<p>Let&#39;s have a show of the Excel effects of this cash flow with the following case example.</p>
<p>Cal&#39;s two options are to either receive a lump sum of $1,000 upfront or an annuity that can pay out $200 a year for the next 5 years. To evaluate which pick would be more favorable, Cal needs to calculate the present value of the annuity. Using the PV function, here&#39;s how to calculate the present value of an annuity in Excel:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">PV</span>(C4,C5,C6,,C7)</code></div>
<p>The first two arguments are 7% interest and 5 payment periods. The <em>pmt</em> argument is filled with the payment per period ($200 in this case, supplied as a negative figure showing outflow for Cal). The future value is disregarded here while the next argument confirms the annuity type as regular or due. 0 is mentioned in the first instance but you may leave the cell blank or skip this argument as it would default to 0 anyway. For annuity-due, this argument will have to be filled as 1, like in the second instance.</p>
<img decoding="async" class="aligncenter size-full wp-image-10588" src="https://exceltrick.com/wp-content/uploads/2023/10/caluclating-present-value-in-excel_05.png" alt="PV Formula of Series of Cash Flows (Annuity)" width="423" height="258" title="How to Calculate Present Value in Excel (With Examples) 44">
<p>The present value of annuity-immediate is $820 and that of annuity-due is $877. By comparison, it would be more favorable for Cal to take up the lump sum of $1,000.</p>
<p><strong>Note:</strong> As mentioned earlier, annuity payments may be at any regular time intervals (such as yearly, monthly, etc. If it were monthly, let&#39;s assume, the calculation will require adjustments with the interest rate and number of payment periods (just like how we saw with compound interest). Following is the adjustment made in the formula for you:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">PV</span>(C4<span class="operator">/</span>12,C5<span class="operator">*</span>12,C6,,C7)</code></div>
<p>For monthly payouts, <em>rate</em> is divided by 12 and <em>nper</em> is multiplied by 12.</p>
<img decoding="async" class="aligncenter size-full wp-image-10589" src="https://exceltrick.com/wp-content/uploads/2023/10/caluclating-present-value-in-excel_06.png" alt="PV Formula of Series of Cash Flows (Annuity)" width="431" height="258" title="How to Calculate Present Value in Excel (With Examples) 45">
<p>For different intervals, the values would be:</p>
<ul>
<li>Biannually: 2</li>
<li>Quarterly: 4</li>
<li>Monthly: 12 (as shown above)</li>
<li>Weekly: 52</li>
</ul>
<h2>Method #3 – PV Formula of Perpetuity</h2>
<p>Now that you are familiar with annuities, we can transition into the how and what of perpetuities. An annuity with an indefinite number of payment periods is a perpetuity. In essence, the present value of a perpetuity is the present value of the future cash flows (no principal involved).</p>
<p>While there are some examples of past and present perpetuities (e.g. perpetual bonds, Gordon Growth model for stock valuation), they are rare. But even so, here&#39;s a simple example to compute the present value of a perpetuity in Excel.</p>
<p>For evaluating the price of two different perpetual bonds, we do not need to use the PV function. Instead comes the simple formula:</p>
<div class="excelFormula"><code><span class="operator">=</span>C4<span class="operator">/</span>C3</code></div>
<p>The coupon amount is divided by the discount rate and that results in the present value of the perpetuity. Since the payments are infinite, there is no consideration of the number of payment periods.</p>
<img decoding="async" class="aligncenter size-full wp-image-10590" src="https://exceltrick.com/wp-content/uploads/2023/10/caluclating-present-value-in-excel_07.png" alt="PV Formula of Perpetuity" width="379" height="200" title="How to Calculate Present Value in Excel (With Examples) 46">
<p>You could be questioning how we can assess the present value of perpetuities if the payouts are indefinite. That is because as per the time value of money, payments received way ahead in the future have dwindling and very low value enough to be defined in the present.</p>
<p>With that, we have concluded our chapter on calculating present value in Excel. Unlock more Excel chapters by reconnecting with us. We&#39;ve got a book-load!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Excel MATCH Function – How To Use</title>
		<link>https://exceltrick.com/functions/excel-match-function/</link>
		
		<dc:creator><![CDATA[Shubhra Jain]]></dc:creator>
		<pubDate>Mon, 25 Sep 2023 06:10:46 +0000</pubDate>
				<category><![CDATA[Functions]]></category>
		<guid isPermaLink="false">https://exceltrick.com/?p=10507</guid>

					<description><![CDATA[The MATCH function in Excel is used to locate a specific value within a cell range or array. It gives us the relative position of the data we are looking for within the array or cell range. The MATCH function proves especially invaluable when handling large datasets, as it enables swift and efficient identification of [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The MATCH function in Excel is used to locate a specific value within a cell range or array. It gives us the relative position of the data we are looking for within the array or cell range.</p>
<p>The MATCH function proves especially invaluable when handling large datasets, as it enables swift and efficient identification of relative data locations, sparing the need to manually scour the entire dataset for the desired information.</p>
<img decoding="async" class="aligncenter size-full wp-image-10513" src="https://exceltrick.com/wp-content/uploads/2023/09/Excel-MATCH-Function.png" alt="Excel MATCH Function" width="753" height="396" title="Excel MATCH Function – How To Use 65">
<h2>Syntax</h2>
<p>The syntax of the MATCH function contains three arguments out of which one is an optional argument.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">MATCH</span>(lookup_value, lookup_array, [match_type])</code></div>
<p style="margin: 0px;"><strong>Arguments:</strong></p>
<p style="padding-left: 30px;">&#39;<em>lookup_value</em>&#39; &#8211; This is a mandatory argument that accepts the value we want to find within a given cell range or array. The input data in the <em>lookup_value</em> argument can be a number, text, or logical value. It can also be a cell reference containing the data.</p>
<p style="padding-left: 30px;">&#39;<em>lookup_array </em>&#39; &#8211; This is also a required argument as it contains the cell range or array in which we want to search for the <em>lookup_value</em>. The value of the <em>lookup_array </em>must be a one-dimensional array either vertical or horizontal. It is important to note that the <em>lookup_array</em> must be sorted in ascending or descending order for the MATCH function to work correctly with certain <em>match_type.</em></p>
<p style="padding-left: 30px;">&#39;<em>match_type</em>&#39; &#8211; This is an optional argument that determines which type of match we wish to perform. The acceptable input values for the argument are -1, 0, or 1 and when left empty, the default value for this argument is 1. When the value is set to 1, the MATCH function <a href="https://exceltrick.com/how-to/find-max-value-in-range/">locates the largest value</a> that is less than or equal to the lookup_value.</p>
<p style="padding-left: 30px;">The <em>lookup_array</em> should be sorted in ascending order. If set to 0, it indicates that we are looking for an exact match. If it is set to -1, the function searches for the smallest value that is greater than or equal to the <em>lookup_value</em>. The <em>lookup_array</em> must be sorted in descending order.</p>
<p>Now that we know all the possibilities of using the above-mentioned arguments, let&#39;s look at a few characteristics of the MATCH function before we dive into some exciting applications and examples.</p>
<h2>Important Characteristics of the MATCH Function</h2>
<p>One of the most notable features of the MATCH function is that it is not case-sensitive. Some of the other aspects of the function that are noteworthy are as follows.</p>
<ul>
<li>When the MATCH function cannot locate the value, we are looking for, it returns a <a href="https://exceltrick.com/functions/na-error-excel/">#N/A error</a>.</li>
<li>One limitation of the MATCH function is that it only works with text up to 255 characters in length.</li>
<li>In case of a duplicate or more than one occurrence of the <em>lookup_value</em> in the data, the MATCH function returns the first match.</li>
<li>When <em>match_type</em> is set to 0 and the data in the <em>lookup_value</em> argument is a text string, we can also use wildcard characters such as the question mark (?) and the asterisk (*). The question marks represent any single character while the asterisk is used to match any sequence of characters before or after. If you wish to locate an actual question mark or asterisk, simply precede it with a tilde (~).</li>
</ul>
<h2>Examples of MATCH Function</h2>
<p>Let&#39;s begin with understanding all the arguments and how they contribute to the MATCH function. Here we will take a sample dataset and use different input values for each argument allowing us to gain deeper insights into the function&#39;s workings.</p>
<img decoding="async" class="aligncenter size-full wp-image-10514" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_01.png" alt="Examples of MATCH Function" width="570" height="307" title="Excel MATCH Function – How To Use 66">
<p>In the first two examples, the input value of the <em>match_type</em> is set to 1. In the first case, we are looking for the value &#39;110&#39; in the array B1:F1. As the <em>lookup_value</em> is not in the dataset and the match_type is set to 1, the MATCH formula looks for the largest value that is less than 110 in the array. As a result, the function returns 5 as the array is sorted in ascending order.</p>
<p>In the next instance, we are looking for the value &#39;100&#39; and the remaining argument values remain the same. As a result, the MATCH function returns a  #N/A error as there is no value that is equal to or is less than 100.</p>
<p>The third example is an ideal case scenario, where we are looking for an exact match for the value &#39;103&#39; in the array. The MATCH function locates the same and returns the position of the <em>lookup_value</em>.</p>
<p>In the last two examples, we are exploring the behavior of the MATCH function where the value of the <em>match_type</em> is set to -1. In such scenarios, the MATCH function identifies the smallest value that is equal to or greater than the <em>lookup_value</em>. So, we can see that when we are looking for &#39;1000&#39;, the function returns an error as there is no data bigger than 1000 in the dataset. On the other hand, when the <em>lookup_value</em> is 990, the MATCH function returns 5 for &#39;995&#39; which is the smallest value that is greater than &#39;990&#39;.</p>
<h3>Example 1 &#8211; Simple Use of MATCH Function</h3>
<p>Suppose you own a furniture store that sells various products such as bookcases, sofas, etc. You now have the dataset which contains details such as product IDs, product names, and total sales for each product to date.</p>
<p>You now wish to determine the ranking of the product based on their sales using the product IDs.</p>
<img decoding="async" class="aligncenter size-full wp-image-10515" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_02.png" alt="Simple Use of MATCH Function" width="315" height="256" title="Excel MATCH Function – How To Use 67">
<p>We can take cell E1 where the user can enter the product ID to look for. We can then use the MATCH function to determine the position or row number of the product ID. As we are looking for an exact match, the formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">MATCH</span>(E1,A2:A11,0)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10516" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_03.png" alt="Simple Use of MATCH Function" width="443" height="263" title="Excel MATCH Function – How To Use 68">
<p>This is extremely useful when the dataset is large. As the current dataset is sorted from highest sales to lowest, the result obtained from the MATCH function also provides us with the product&#39;s ranking or popularity based on sales.</p>
<p>Furthermore, it is evident that the product IDs are crafted in a way where the initial three letters of the product ID align with the initial three letters of the product name. In case the user does not remember the entire product ID, we can take advantage of the wildcard characters supported by the MATCH function. Next, we&#39;ll show you how to do that.</p>
<h2>Example 2 &#8211; Using Wildcard with MATCH Function</h2>
<p>To simplify the user experience, we can ask them to just enter the initial three letters of the product name. Subsequently, we modify the <em>lookup_value</em> argument, where we combine the user-entered first three letters of the product with the wildcard character &#39;*&#39;. This means that the MATCH function will look for a value that begins with the user-entered text followed by any number of characters. The formula will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">MATCH</span>(E1<span class="operator">&amp;</span>"<span class="string">*</span>",A2:A11,0)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10517" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_04.png" alt="Using Wildcard with MATCH Function" width="448" height="301" title="Excel MATCH Function – How To Use 69">
<p>The asterisk has served as a buffer for the remaining characters of the product code &quot;SOF234PQR&quot; beyond the characters entered in E1. As observed in the previous example and stated in the characteristics, the MATCH function is case-insensitive. In the next example, let&#39;s explore the possibility of using the MATCH function in a case-sensitive manner.</p>
<h2>Example 3 &#8211; Making MATCH Function Case-sensitive</h2>
<p>Suppose you are a marketing manager planning a fresh marketing campaign for your company, and you wish to collaborate with social media influencers to promote the campaign. You have a dataset that includes details of potential influencers, such as their name, username, and the number of followers they have on social media.</p>
<p>To make it easy to filter out, you now wish to identify the position of the influencer based on their username.</p>
<img decoding="async" class="aligncenter size-full wp-image-10518" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_05.png" alt="Making MATCH Function Case-sensitive" width="496" height="503" title="Excel MATCH Function – How To Use 70">
<p>As we can see, the usernames contain both uppercase and lowercase letters, making it clear that relying solely on the MATCH function would be insufficient. Instead, we will use a combination of the <a href="https://exceltrick.com/functions/excel-exact-function/">EXACT function</a> with the MATCH function.</p>
<p>The EXACT function will search for an exact case-sensitive match of the <em>lookup_value</em>. If it finds a match, the EXACT function returns TRUE, else it returns FALSE. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">EXACT</span>(E1,B2:B15)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10519" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_06.png" alt="Making MATCH Function Case-sensitive" width="474" height="333" title="Excel MATCH Function – How To Use 71">
<p>The EXACT function returned an array of TRUE and FALSE indicating where it found a perfect case-sensitive match. Now, we can use the MATCH function to look for &quot;TRUE&quot; in the previous array. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">MATCH</span>(TRUE,<span class="function">EXACT</span>(E1,B2:B15),0)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10520" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_07.png" alt="Making MATCH Function Case-sensitive" width="488" height="336" title="Excel MATCH Function – How To Use 72">
<p>So, together, the EXACT function helps us figure out if there is a perfect match, and the MATCH function helps us find where that perfect match is in a list.</p>
<p>There have likely been multiple occasions when you&#39;ve had to compare two columns to determine matches and differences. Employing the MATCH function is one effective method for accomplishing this task. Let&#39;s learn how to use it in the next example.</p>
<h2>Example 4 &#8211; Comparing Two Lists Using MATCH Function</h2>
<p>In this scenario, we have an upcoming technical training program that is open to all teams in the company. We now have two lists of email addresses, the first list contains the email addresses of the technical team, and List 2 contains a list of email addresses of employees who have been invited to a special training program.</p>
<p>The goal is to determine which email addresses from the training program list are a part of the tech team and which ones are not.</p>
<img decoding="async" class="aligncenter size-full wp-image-10521" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_08.png" alt="Comparing Two Lists Using MATCH Function" width="463" height="330" title="Excel MATCH Function – How To Use 73">
<p>First, the MATCH function compares each cell in column B with all the data in column A. The formula used is as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">MATCH</span>(B2,A:A,0)</code></div>
<p>We drag and drop the formula till the end of the dataset.</p>
<img decoding="async" class="aligncenter size-full wp-image-10522" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_09.png" alt="Comparing Two Lists Using MATCH Function" width="473" height="330" title="Excel MATCH Function – How To Use 74">
<p>The next step is to check if the return value of the MATCH function is an error (specifically, a #N/A error). If there is an error, the <a href="https://exceltrick.com/functions/excel-isna-function/">ISNA function</a> returns TRUE; otherwise, it returns FALSE. The formula will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">ISNA</span>(<span class="function">MATCH</span>(B2,A:A,0))</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10523" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_10.png" alt="Comparing Two Lists Using MATCH Function" width="474" height="333" title="Excel MATCH Function – How To Use 75">
<p>The last step is the simplest where we enclose the above formula in a basic <a href="https://exceltrick.com/functions/excel-if-statement/">IF function</a>. It checks the return value of the ISNA and MATCH functions. If the value is TRUE, meaning the email address in column B was not found in column A), it displays &quot;Not in Tech Team&quot;; otherwise, it displays &quot;Member of the Tech Team.&quot; The complete formula will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">IF</span>(<span class="function">ISNA</span>(<span class="function">MATCH</span>(B2,A:A,0)), "<span class="string">Not in Tech Team</span>", "<span class="string">Member of the Tech Team</span>")</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10524" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_11.png" alt="Comparing Two Lists Using MATCH Function" width="747" height="368" title="Excel MATCH Function – How To Use 76">
<p>In case, the columns to be compared contain case-sensitive values, combine the logic mentioned in the previous example to improve this formula.</p>
<h2>Example 5 &#8211; Using VLOOKUP with MATCH Function</h2>
<p>Suppose you work in the HR department, and you have an Excel dataset containing information about employees, including their names, departments, and salaries. Now, you want to retrieve an employee&#39;s salary based on their name.</p>
<img decoding="async" class="aligncenter size-full wp-image-10525" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_12.png" alt="Using VLOOKUP with MATCH Function" width="609" height="383" title="Excel MATCH Function – How To Use 77">
<p>The easiest and the most preferred option is to use the <a href="https://exceltrick.com/functions/vlookup-in-excel/">VLOOKUP function</a>. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">VLOOKUP</span>(G1,$A$2:$D$11,3,FALSE)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10526" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_13.png" alt="Using VLOOKUP with MATCH Function" width="807" height="396" title="Excel MATCH Function – How To Use 78">
<p>Problem solved. Now, due to some reasons, you had to delete Column B containing the details about &#39;Department&#39;. Upon deleting the column, the above formula adjusted the value of the <em>table_array</em> but returned the value from the third column, which is &#39;Joining Date&#39;.</p>
<img decoding="async" class="aligncenter size-full wp-image-10527" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_14.png" alt="Using VLOOKUP with MATCH Function" width="754" height="400" title="Excel MATCH Function – How To Use 79">
<p>This is a limitation of the VLOOKUP formula where if we add or delete columns, the function returns incorrect data. In this case, if we delete column C as well, the function will return a <a href="https://exceltrick.com/functions/ref-error-excel/">#REF! error</a>. To avoid this issue, we can use the MATCH function to dynamically determine the column index for the VLOOKUP function.</p>
<p>For instance, in this example, we are looking for values in the column named &#39;Salary (USD)&#39;. Using the MATCH function, we can dynamically determine the column index by finding the position of &quot;Salary (USD)&quot; in the first row (row 1) of the data. This ensures that if we add or remove columns, the formula will still work correctly. To find the column number, the formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">MATCH</span>("<span class="string">Salary (USD)</span>",A1:D1,0)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10528" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_15.png" alt="Using VLOOKUP with MATCH Function" width="849" height="436" title="Excel MATCH Function – How To Use 80">
<p>Now, we can use this in the above-mentioned VLOOKUP function. The formula will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">VLOOKUP</span>(G1, $A$1:$D$1, <span class="function">MATCH</span>("<span class="string">Salary (USD)</span>",A1:D1,0), FALSE)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10529" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_16.png" alt="Using VLOOKUP with MATCH Function" width="1014" height="438" title="Excel MATCH Function – How To Use 81">
<p>Now, even if we add or delete columns in the data table, the formula will still correctly retrieve the salary because it uses the MATCH function to determine the column index dynamically based on the column header &#39;Salary (USD)&#39;. The same logic can be applied while using the <a href="https://exceltrick.com/functions/hlookup-in-excel-with-examples/">HLOOKUP function</a>.</p>
<p>Alternatively, we can fix the column again using the MATCH function but use the <a href="https://exceltrick.com/functions/excel-index-function/">INDEX function</a> to return the match against the lookup value. The MATCH and INDEX functions are often used as a duo and now you&#39;ll see why. Use the formula below as a base to retrieve data relevant to the lookup value without facing trouble from dynamic changes:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">INDEX</span>(C2:C11,<span class="function">MATCH</span>(G1,A2:A11,0))</code></div>
<p>Since the functions aren&#39;t restricted to retrieving data from the 3rd column, the result won&#39;t be subject to fluctuations with changes in the dataset. The MATCH function locates an exact match of the value in G1 in A2:A11 as 2. The INDEX function takes that position and returns the corresponding value from C2:C11 which is 55000.</p>
<img decoding="async" class="aligncenter size-full wp-image-10530" src="https://exceltrick.com/wp-content/uploads/2023/09/match-function-in-excel_17.png" alt="Using VLOOKUP with MATCH Function" width="601" height="305" title="Excel MATCH Function – How To Use 82">
<p>Practice more yourself to discover how the MATCH function fits into your work and projects. While you uncover more exciting applications, we will work on yet another Excel function to add to your repository. Stay tuned for an even broader range of Excel tools at your fingertips.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Use Exponents in Excel (3 Quick &#038; Easy Ways)</title>
		<link>https://exceltrick.com/how-to/use-exponents-in-excel/</link>
		
		<dc:creator><![CDATA[Mehwish Javaid]]></dc:creator>
		<pubDate>Mon, 18 Sep 2023 07:27:00 +0000</pubDate>
				<category><![CDATA[How To's]]></category>
		<guid isPermaLink="false">https://exceltrick.com/?p=10487</guid>

					<description><![CDATA[The exponent, also known as power, is the number a base is raised by in mathematics. Luckily, you will find the same mechanism is possible in Excel by a dedicated function, an equally dedicated operator, and a similarly dedicated format. Use the POWER function or the caret symbol to apply an exponent to a base [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The exponent, also known as power, is the number a base is raised by in mathematics. Luckily, you will find the same mechanism is possible in Excel by a dedicated function, an equally dedicated operator, and a similarly dedicated format. Use the POWER function or the caret symbol to apply an exponent to a base and have the calculated figure returned. Use the <em>Format Cells</em> settings to superscript any value to be displayed as an exponent.</p>
<p>Students, here&#39;s a little tip for you. Instead of punching figures over and over in a calculator, you can enter all your problems (please keep them numerical) on a spreadsheet and have expressions with powers calculated in no time for multiple instances.</p>
<p>So, you could be one of such students immersed in math, a professor creating Q&amp;A for your valuable (albeit frustrating) math book, a doctor in the making first trying to make head and tail of scientific research, or a side hustler deciding on financial investments. Either way, you are here to get conclusions or make informed decisions based on this simple mathematical model and we&#39;ll show you how Excel factors in.</p>
<p>Exponents, thou rise to power!</p>
<img decoding="async" class="aligncenter size-full wp-image-10492" src="https://exceltrick.com/wp-content/uploads/2023/09/How-to-Use-Exponents-in-Excel.png" alt="How to Use Exponents in Excel" width="753" height="396" title="How to Use Exponents in Excel (3 Quick &amp; Easy Ways) 94">
<h2>Method #1 – Using POWER Function</h2>
<p>The first method covers using exponents in Excel with the POWER function. The POWER function raises a number to a power and returns the result. It is as simple as that, so we&#39;ll take a look at a sample formula with the POWER function to calculate the value of a number raised to a power:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">POWER</span>(B3,C3)</code></div>
<p>The POWER function takes a number each for a base and an exponent. Column B contains a list of numbers we will be using as the base for the exponents while column C has all the respective exponents.</p>
<p>The number 4 in B3 is raised to the power 5 and so the calculation results in 1024. The remaining results of the POWER function can be seen below:</p>
<img decoding="async" class="aligncenter size-full wp-image-10493" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-use-exponents-in-excel_01.png" alt="Using POWER Function" width="385" height="314" title="How to Use Exponents in Excel (3 Quick &amp; Easy Ways) 95">
<p>That is how to use the POWER function on a basic level. Now we&#39;ll show you how to incorporate the POWER function into more of a complex calculation, part of which requires raising a value to another specified value. Let&#39;s say that, as an example, we are calculating the future value of investments with the formula:</p>
<div class="excelFormula"><code>FV = PV (1 + r)<sup>n</sup></code></div>
<p>The number of time periods is the required exponent here and we can place the POWER function in the formula to raise (1 + r) to the power n like so:</p>
<div class="excelFormula"><code><span class="operator">=</span>B3<span class="operator">*</span><span class="function">POWER</span>(((1<span class="operator">+</span>C3<span class="operator">/</span>12)),(D3<span class="operator">*</span>12))</code></div>
<p>The POWER function takes the base (1 + r) as (1 + C3/12) which is the annual interest rate divided by 12 months for monthly compounding frequency. &quot;n&quot; which is the exponent is set as (D3*12) which is 5 years times the compounding frequency in a year (i.e. 12 again). The POWER function does the work here and the result is then multiplied by the present value in B3 to return the future value as $4253.</p>
<img decoding="async" class="aligncenter size-full wp-image-10494" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-use-exponents-in-excel_02.png" alt="Using POWER Function" width="524" height="214" title="How to Use Exponents in Excel (3 Quick &amp; Easy Ways) 96">
<h2>Method #2 – Using Caret Symbol</h2>
<p>Use the caret symbol (^) to apply exponents in Excel. Caret is a quick and simple way of raising a numerical base to a power where simply the base and the exponent are separated by a caret readily available on your keyboard. Our example case below will illustrate the usage of the caret in applying an exponent to a base and returning the relevant result in Excel. Starting with the following formula:</p>
<div class="excelFormula"><code><span class="operator">=</span>B3<span class="operator">^</span>C3</code></div>
<p>The number 4 in B3 makes the base for the exponent in C3 which is 5. The base is followed by the caret and the exponent, with the result returned as 1024.</p>
<img decoding="async" class="aligncenter size-full wp-image-10495" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-use-exponents-in-excel_03.png" alt="Using Caret Symbol" width="385" height="315" title="How to Use Exponents in Excel (3 Quick &amp; Easy Ways) 97">
<p>The caret symbol can just as easily be part of an intricate formula where you need to use exponents. Drawing from the earlier case example, let&#39;s use the caret this time to raise a component in the calculation of the future values of investments to the power of a defined time period:</p>
<div class="excelFormula"><code><span class="operator">=</span>B3<span class="operator">*</span>(1<span class="operator">+</span>C3<span class="operator">/</span>12)<span class="operator">^</span>(D3<span class="operator">*</span>12)</code></div>
<p>Again, we take the base of (1+C3/12) and raise it to the power (D3*12) using the caret. This expression equals 1.417 which is multiplied by B3 (i.e. 3000) to land at the future value of $4253 in 5 years with the interest compounded monthly.</p>
<img decoding="async" class="aligncenter size-full wp-image-10496" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-use-exponents-in-excel_04.png" alt="Using Caret Symbol" width="524" height="214" title="How to Use Exponents in Excel (3 Quick &amp; Easy Ways) 98">
<h2>Method #3 – Using Format Cells Option</h2>
<p>With the <em>Format Cells</em> settings, you can add exponents in Excel. This method does not calculate the base and its power. It does not even change the actual value in the cell. <em>Format Cells</em> will only alter the formatting of a cell without performing a calculation or changing the value. Only <em>Format Cells</em> can display an exponent as a superscript. The steps given ahead highlight how to use <em>Format Cells</em> to display an exponent in a cell in Excel:</p>
<ul>
<li>Enter in the target cell the value for the base along with the exponent. E.g. for arriving at &quot;E = mc<sup style="color: initial;">2</sup><span style="font-size: revert; color: initial;">&quot;, we will enter &quot;E = mc2&quot; as shown below:</span></li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10497" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-use-exponents-in-excel_05.png" alt="Using Format Cells Option" width="410" height="267" title="How to Use Exponents in Excel (3 Quick &amp; Easy Ways) 99"></li>
<li>Change the format of the cell to the <em>Text</em> format by clicking on the <em>Number Format</em> bar and selecting the <em>Text</em></li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10498" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-use-exponents-in-excel_06.png" alt="Using Format Cells Option" width="530" height="634" title="How to Use Exponents in Excel (3 Quick &amp; Easy Ways) 100"></li>
<li>Edit the target cell (in the <em>Formula Bar</em> or by double-clicking the cell itself) and select the value you want to display as an exponent. In the given case example, we have selected 2 to display it as a <a href="https://exceltrick.com/how-to/square-a-number-in-excel/">square</a>.</li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10499" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-use-exponents-in-excel_07.png" alt="Using Format Cells Option" width="483" height="394" title="How to Use Exponents in Excel (3 Quick &amp; Easy Ways) 101"></li>
<li>Right-click the cell and select the <em>Format Cells</em> option or use the <strong>Ctrl + 1</strong> keys to open the <em>Format Cells</em> dialog box.</li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10500" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-use-exponents-in-excel_08.png" alt="Using Format Cells Option" width="409" height="328" title="How to Use Exponents in Excel (3 Quick &amp; Easy Ways) 102"></li>
<li>Mark the <em>Superscript</em> checkbox in the <em>Effects</em></li>
<li>The <em>Preview</em> box will show you the top alignment and decrease in the appearance of the font of the sample text.</li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10501" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-use-exponents-in-excel_09.png" alt="Using Format Cells Option" width="540" height="510" title="How to Use Exponents in Excel (3 Quick &amp; Easy Ways) 103"></li>
<li>Hit the <em>OK</em> button in the dialog box. The value selected in the cell will be superscripted.</li>
<li>Press the <strong>Enter</strong> key to apply the format change.</li>
</ul>
<p>Your choice of text will show as an exponent:</p>
<img decoding="async" class="aligncenter size-full wp-image-10502" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-use-exponents-in-excel_10.png" alt="Using Format Cells Option" width="409" height="270" title="How to Use Exponents in Excel (3 Quick &amp; Easy Ways) 104">
<p><strong>Notes:</strong></p>
<p>The format of a cell requires a change to the <em>Text</em> format when superscripting part of a cell&#39;s value. If the full contents of the cell are to be in superscript, there is no need to switch the format of the cell first.</p>
<p>Any value can be superscripted: numeric, alphabetic, or alphanumeric.</p>
<p>Those were all the methods of doing work the exponent way in Excel. Now you can easily and quickly raise any number or numeric calculation to a power to arrive at the computed result or simply superscript any value in place. While you&#39;re powering on with powers, we&#39;ll power up another handy guide to exponentially raise your Excel skills.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Excel LOOKUP Function – How To Use</title>
		<link>https://exceltrick.com/functions/excel-lookup-function/</link>
		
		<dc:creator><![CDATA[Shubhra Jain]]></dc:creator>
		<pubDate>Mon, 11 Sep 2023 07:09:00 +0000</pubDate>
				<category><![CDATA[Functions]]></category>
		<guid isPermaLink="false">https://exceltrick.com/?p=10461</guid>

					<description><![CDATA[The LOOKUP function allows us to easily retrieve required values from a given dataset. When working with large datasets, the function is extremely useful as it searches for a value within a given array or cell range and returns a corresponding value from the same position in another range. The LOOKUP function offers two forms [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The LOOKUP function allows us to easily retrieve required values from a given dataset. When working with large datasets, the function is extremely useful as it searches for a value within a given array or cell range and returns a corresponding value from the same position in another range.</p>
<p>The LOOKUP function offers two forms which are vector form and array form. The details of each are discussed further in the article. Beyond its functionality to look for an exact match, the function also offers to look for an approximate match.</p>
<img decoding="async" class="aligncenter size-full wp-image-10465" src="https://exceltrick.com/wp-content/uploads/2023/09/Excel-LOOKUP-Function.png" alt="Excel LOOKUP Function" width="753" height="396" title="Excel LOOKUP Function – How To Use 120">
<h2>Syntax</h2>
<p>The LOOKUP function encompasses two different syntaxes and each one of them provides a distinct functionality. Depending on the nature of our data retrieval needs, we can opt for the syntax that provides greater flexibility in addressing different lookup scenarios.</p>
<p>The first one is called the vector form which accepts and deals with single array data. The syntax of the vector form of the LOOKUP function is as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">LOOKUP</span>(lookup_value, lookup_vector, [result_vector])</code></div>
<p style="margin: 0px;"><strong>Arguments:</strong></p>
<p>The vector form of the LOOKUP function is primarily used for simple one-dimensional lookups where we have separate columns/rows for lookup and result values. It accepts three arguments out of which two are mandatory.</p>
<p style="padding-left: 30px;">&#39;<em>lookup_value</em>&#39; &#8211; This is a mandatory argument that accepts the value that we are looking for. The data in the <em>lookup_value</em> can be a variety of data types, including numbers, text, logical values, as well as names or references that point to specific values.</p>
<p style="padding-left: 30px;">&#39;<em>lookup_vector</em>&#39; &#8211; This is also a mandatory argument as it contains the cell range or array where the LOOKUP function searches the <em>lookup_value</em>. Usually, the <em>lookup_vector</em> is a one-row or one-column cell range. However, if the input value includes more than one row or column, the LOOKUP function still considers the first row or column.</p>
<p style="padding-left: 30px;">&#39;<em>result_vector</em>&#39; &#8211; This is an optional argument where the input value is a cell range which is ideally a single row or column range. As it is an optional argument, when it is left blank, the LOOKUP function returns the matched value found in When <em>result_vector</em> is defined, the function locates the match in <em>lookup_vector</em> and returns the corresponding value from the <em>result_vector</em>.</p>
<p>The second form of the LOOKUP function is called the array form. In this variant, the LOOKUP function finds the given value in the first column or row of the array and returns the corresponding value from the last column or row of the array.</p>
<p>The syntax of the array form of the LOOKUP function is as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">LOOKUP</span>(lookup_value, array)</code></div>
<p style="margin: 0px;"><strong>Arguments:</strong></p>
<p>This form only accepts two arguments, and both are mandatory. The details of each are mentioned below.</p>
<p style="padding-left: 30px;">&#39;<em>lookup_value</em>&#39; &#8211; This argument accepts the value that we wish to search for in the array.</p>
<p style="padding-left: 30px;">&#39;<em>array </em>&#39; &#8211; This includes the value of the array or cell range where we wish to search the <em>lookup_value</em>.</p>
<p><strong>Note:</strong> One essential point to note about the <em>lookup_vector</em> and <em>array</em> arguments is that the LOOKUP function assumes that the data in the given arguments is arranged in ascending order. In the case of the <em>array</em> argument, if there is more than one row or column, the first column or row of the array must be sorted in ascending order.</p>
<h2>Important Characteristics of the LOOKUP Function</h2>
<p>One of the basic characteristics of the LOOKUP function is that it is case-insensitive. Other noteworthy features of the LOOKUP function are as follows.</p>
<ul>
<li>When the value in the lookup_value argument is smaller than the smallest value in the lookup_vector or first row or column of the array, the LOOKUP function throws a <a href="https://exceltrick.com/functions/na-error-excel/">#N/A error</a>.</li>
<li>In another scenario, if the LOOKUP function cannot find the given <em>lookup_value</em>, it returns the closest smaller value within the <em>array</em> or <em>lookup_vector</em>.</li>
<li>When using the array form of the LOOKUP function, if the <em>array</em> argument contains more rows than columns or an equal number of rows and columns, the function searches for the desired value in the first column. This essentially means that the LOOKUP function behaves like the <a href="https://exceltrick.com/functions/hlookup-in-excel-with-examples/">HLOOKUP function</a>.</li>
<li>On the other hand, if the array argument includes more columns than rows, the function looks for the desired data in the first row which is a characteristic of the <a href="https://exceltrick.com/functions/vlookup-in-excel/">VLOOKUP function</a>.</li>
</ul>
<p>Although the LOOKUP function imitates features of the HLOOKUP and VLOOKUP functions, the latter two allow us to perform indexing both vertically and horizontally, while LOOKUP only returns the value from the last row or column.</p>
<h2>Examples of LOOKUP Function</h2>
<p>Let&#39;s start by using diverse inputs for the arguments of the LOOKUP function. This will help us grasp its fundamental functionality and both of its forms. Here we have taken a sample dataset that contains employee ID numbers, names, along with their <a href="https://exceltrick.com/how-to/calculate-age-in-excel/">ages (in years)</a>.</p>
<img decoding="async" class="aligncenter size-full wp-image-10466" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_01.png" alt="Examples of LOOKUP Function" width="229" height="274" title="Excel LOOKUP Function – How To Use 121">
<p>Let&#39;s take cell E1 which contains the data we are looking up. So, in this case, we are looking up Employee ID 105.</p>
<img decoding="async" class="aligncenter size-full wp-image-10467" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_02.png" alt="Examples of LOOKUP Function" width="513" height="275" title="Excel LOOKUP Function – How To Use 122">
<p>The first instance shows the vector form of the LOOKUP function when the optional argument <em>result_vector</em> is left empty. As we are looking for &#39;105&#39; in the cell range A2:A12, the function simply returns the matched value.</p>
<p>In the next case, the value of <em>result_vector</em> is mentioned. The LOOKUP function finds &#39;105&#39; in the given cell range and returns the corresponding value from cell range B2:B12 as &quot;Daniel Brown&quot;.</p>
<p>The last instance showcases the array form of the LOOKUP function where it looks for &#39;105&#39; in the first column and returns the corresponding value from the last column.</p>
<h3>Example 1 &#8211; Simple Use of LOOKUP Function</h3>
<p>Imagine you are in the market for a new phone, and you have downloaded a price list of the latest models in an Excel spreadsheet. Your aim now is to explore the price details of the different models you are considering. This way, you can check if it fits your budget.</p>
<img decoding="async" class="aligncenter size-full wp-image-10468" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_03.png" alt="Simple Use of LOOKUP Function" width="361" height="390" title="Excel LOOKUP Function – How To Use 123">
<p>This is a classic case of the LOOKUP function which will allow you to search for a particular mobile phone model and retrieve its corresponding price. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">LOOKUP</span>(E1,$A$2:$A$11,B2:B11)</code></div>
<p>The user can enter the <em>lookup_value</em> in cell E1. For instance, if we wish to check the price of &quot;Samsung Galaxy&quot;, we will enter the same in cell E1. The LOOKUP function scans the cell range $A$2:$A$11 which is the <em>Mobile Model</em> column to find the exact match. Once the match is found, it will return the corresponding price (500 USD) for the model.</p>
<img decoding="async" class="aligncenter size-full wp-image-10469" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_04.png" alt="Simple Use of LOOKUP Function" width="711" height="401" title="Excel LOOKUP Function – How To Use 124">
<p>Now you can keep changing the model name in cell E2 and quickly retrieve the price. This will help you in your decision-making. Now, consider a scenario where you would like to perform a reverse lookup. Imagine you have a predetermined budget and are interested in finding out which mobile phone model has a price slightly below that budget.</p>
<p>We can use the LOOKUP function again. This time, it can be used to search for an approximate match in terms of price and return the mobile model that fits just under your specified budget. It is important to note that when the LOOKUP function does not find an exact match, it matches the closest smaller value.</p>
<p>We can ask the user to enter the budget in cell E4 and the formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">LOOKUP</span>(E4,$B$2:$B$11,A2:A11)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10470" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_05.png" alt="Simple Use of LOOKUP Function" width="711" height="400" title="Excel LOOKUP Function – How To Use 125">
<p>By entering 810 USD as the <em>lookup_value</em> in cell E4, the LOOKUP function searches for the mobile model that is equal to or less than 810 USD. In this case, it should return &quot;iPhone 12&quot; with a price of 800 USD, however, it does not.</p>
<p>The issue is the basic characteristics of the LOOKUP function that it assumes and necessitates that the value in <em>lookup_vector </em>is sorted in ascending order. Here, the <em>lookup_vector</em> refers to $B$2:$B$11 containing the prices. Let&#39;s sort the values and repeat the formula.</p>
<img decoding="async" class="aligncenter size-full wp-image-10471" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_06.png" alt="Simple Use of LOOKUP Function" width="715" height="400" title="Excel LOOKUP Function – How To Use 126">
<p>Now you have the correct return value.</p>
<p>As we are already aware, the LOOKUP function comes in two distinct forms. In the preceding example, we observed the functioning of the vector form. Let&#39;s delve into the array form of the LOOKUP function in the subsequent example.</p>
<h3>Example 2 &#8211; Using Array Form of LOOKUP Function</h3>
<p>Suppose we have the complete product details stored in an Excel sheet where each row in the dataset represents a different product, and the columns provide various attributes and characteristics of each product. Now, we wish to retrieve the product price based on the product ID.</p>
<img decoding="async" class="aligncenter size-full wp-image-10472" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_07.png" alt="Using Array Form of LOOKUP Function" width="689" height="385" title="Excel LOOKUP Function – How To Use 127">
<p>As we already know, in its array form, the LOOKUP function dynamically adjusts its behavior according to the dimensions of the array provided. In this case, the number of rows is more than the <a href="https://exceltrick.com/how-to/add-total-row-in-excel-table/">total columns</a>, therefore the function looks for the lookup_value within the first column which is Product ID in our case. The return value will be data from the last column of the array, situated at the corresponding position matching the product ID which is the Price column.</p>
<p>This is a perfect case scenario to use the array form of the LOOKUP function. Let&#39;s take cell G1 where the user can enter the Product ID which will be the input value for the <em>lookup_value </em>argument. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">LOOKUP</span>(G1,A1:E11)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10473" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_08.png" alt="Using Array Form of LOOKUP Function" width="796" height="401" title="Excel LOOKUP Function – How To Use 128">
<p>Although the LOOKUP function gave us the required value, it is recommended to use the VLOOKUP function or HLOOKUP function depending on the data especially since they do not require data sorting.</p>
<h3>Example 3 &#8211; Identifying Latest Stock Prices with LOOKUP Function</h3>
<p>Suppose you are looking to invest in a few stocks and have been tracking the stock prices of three companies: Apple (AAPL), Google (GOOG), and Microsoft (MSFT). You have downloaded some historical stock data, including the date, and closing price for each trading day, which gets updated at the end of each day.</p>
<p>Now, combing through the data is tedious, therefore the goal is to easily find the latest closing price for any of these companies based on their stock name.</p>
<img decoding="async" class="aligncenter size-full wp-image-10474" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_09.png" alt="Identifying Latest Stock Prices with LOOKUP Function" width="391" height="445" title="Excel LOOKUP Function – How To Use 129">
<p>As we already know that one of the features of the LOOKUP function is when the <em>lookup_value </em>is not found in the <em>lookup_vector</em>, it returns the next value on the lesser side.</p>
<p>Additionally, the LOOKUP function operates under the assumption that the data is sorted in ascending order, therefore it returns the last value when the <em>lookup_value</em> is greater than all the values found in the <em>lookup_vector</em>. We will use this characteristic of the LOOKUP function to our advantage.</p>
<p>Let&#39;s take cell F1 where the user can enter the Stock name. Now, we will check if the value in F1 matches any value in cell range B2:B13.</p>
<div class="excelFormula"><code><span class="operator">=</span>B2:B13<span class="operator">=</span>F1</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10475" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_10.png" alt="Identifying Latest Stock Prices with LOOKUP Function" width="671" height="449" title="Excel LOOKUP Function – How To Use 130">
<p>As we can see, we have an array comprising TRUE and FALSE values, signifying matches, and non-matches, respectively. By dividing 1 by the array, we get an array of 1s for matches and errors (#DIV/0!) for non-matches.</p>
<div class="excelFormula"><code><span class="operator">=</span>1<span class="operator">/</span>(B2:B13<span class="operator">=</span>F1)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10476" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_11.png" alt="Identifying Latest Stock Prices with LOOKUP Function" width="608" height="454" title="Excel LOOKUP Function – How To Use 131">
<p>Now we use the above array as the input value for the <em>lookup_vector</em> argument. The next step is when the LOOKUP function searches for 2 in the above array.</p>
<p>Since it will not be found, it defaults to the last 1. This corresponds to the latest &quot;GOOG&quot; entry. The formula will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">LOOKUP</span>(2,1<span class="operator">/</span>(B2:B13<span class="operator">=</span>F1),C2:C13)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10477" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_12.png" alt="Identifying Latest Stock Prices with LOOKUP Function" width="711" height="495" title="Excel LOOKUP Function – How To Use 132">
<p>We finally have the latest closing price for &quot;GOOG&quot; which is $2795. The same logic can be applied to find the last non-empty cell in a column.</p>
<h3>Example 4 – Finding Last Non-Blank Cell in Column</h3>
<p>Lastly, one of the glories of the LOOKUP function is being able to find the last non-blank cell with it. Finding the last entry in a database can be useful for tracking stock prices (as we&#39;ve seen in the prior example), weather conditions, delivery status, or (arguably the most important one) the latest show or movie on Netflix. Cue list:</p>
<img decoding="async" class="aligncenter size-full wp-image-10478" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_13.png" alt="Finding Last Non-Blank Cell in Column" width="319" height="227" title="Excel LOOKUP Function – How To Use 133">
<p>Changing the condition in the <em>lookup_vector</em>, this is the formula we will use to find the last non-empty cell in Excel with the LOOKUP function:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">LOOKUP</span>(2,1<span class="operator">/</span>(B:B<span class="operator">&lt;&gt;</span>""),B:B)</code></div>
<p>The <em>lookup_vector</em> is set as 1/(B:B&lt;&gt;&quot;&quot;) resulting in a spill array that gives us 1 for every row in the column that is a non-blank cell (first 9 cells are non-blank) and a <a href="https://exceltrick.com/functions/div-by-0-error-in-excel/">#DIV/0! error</a> for every blank cell.</p>
<p>With the <em>lookup_value</em> as 2, LOOKUP will default to its nature of returning the closest lesser value which as per LOOKUP&#39;s ascending order assumption will be the last 1 in the array, effectively the last entry in the dataset. With the last 1 chosen, the <em>result_vector </em>will be the corresponding value from column B (defined by B:B).</p>
<p>The final entry has been returned as &quot;Spy Ops&quot;.</p>
<img decoding="async" class="aligncenter size-full wp-image-10479" src="https://exceltrick.com/wp-content/uploads/2023/09/lookup-function-in-excel_14.png" alt="Finding Last Non-Blank Cell in Column" width="665" height="268" title="Excel LOOKUP Function – How To Use 134">
<p>Now that you have a fair understanding of the LOOKUP function, it must be clear that it provides great functionality to streamline tasks such as data manipulation and data retrieval. Practice and identify more use cases of the function in your daily tasks. While you ace the LOOKUP function, we will work on another useful Excel function to add to your knowledge base.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Remove Parentheses in Excel (3 Easy Ways + VBA)</title>
		<link>https://exceltrick.com/how-to/remove-parentheses-in-excel/</link>
		
		<dc:creator><![CDATA[Mehwish Javaid]]></dc:creator>
		<pubDate>Mon, 04 Sep 2023 06:41:07 +0000</pubDate>
				<category><![CDATA[How To's]]></category>
		<guid isPermaLink="false">https://exceltrick.com/?p=10433</guid>

					<description><![CDATA[Data speaks to everyone differently. Left alignment, right alignment, font size 11 or 12, format this way, or severely not this way, to delimiter or not to delimiter; that is the problem. But it shouldn&#39;t be with Excel. Too often, using the word lightly, data is stored in a way that suits the creator or [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Data speaks to everyone differently. Left alignment, right alignment, font size 11 or 12, format this way, or severely not this way, to delimiter or not to delimiter; that is the problem. But it shouldn&#39;t be with Excel. Too often, using the word lightly, data is stored in a way that suits the creator or editor. Their way might be suitable for their tasks but for what you need to get done, hindrance all around.</p>
<p>What would necessitate the removal of any form of brackets in data? A special character when used as part of a text string may result in data discrepancy or as an inhibitor in data processing. Say there&#39;s a list of phone numbers with area codes enclosed in round brackets and the system used for contact cannot process characters other than numbers. This will require that the parentheses be ditched for consistency and smooth processing. Let&#39;s make this clearer with an example.</p>
<img decoding="async" class="aligncenter size-full wp-image-10437" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_01.png" alt="how-to-remove-parentheses-in-excel_01" width="473" height="313" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 152">
<p>The dataset here contains phone numbers that can do without parentheses (for reasons said above). Also, column D is populated with the city name and then the state name bracketed, separated by a comma. We need the data sorted with the city and state in separate columns and before we launch into splitting columns with the comma delimiter, the parentheses need a goodbye. Today&#39;s tutorial will give them their farewell.</p>
<p>Do note that while we can say parentheses and define them collectively, they are two separate characters: an opening parenthesis and a closing parenthesis. And that is how we&#39;ll get rid of them; one by one. Spoiler says we have a couple of methods that remove them collectively.</p>
<p><strong>Note:</strong> Other than the LEFT and FIND functions method (which removes the parentheses and its contents), all other 3 methods remove every instance of the stated parenthesis from a cell&#39;s value. You can set the instance number in the SUBSTITUTE function to remove a particular occurrence (as shown later).</p>
<p>Parentheses terminator mode &#8211; activated!</p>
<img decoding="async" class="aligncenter size-full wp-image-10452" src="https://exceltrick.com/wp-content/uploads/2023/09/Removing-Parentheses-In-Excel.png" alt="Removing Parentheses In Excel" width="753" height="396" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 153">
<h2>Method #1 – Using Find and Replace Feature</h2>
<p>Remove parentheses with the <em>Find and Replace</em> feature in Excel. Use <em>Find and Replace</em> as a search bar to locate the parentheses, remove them, and replace them with user-supplied text. As of now, we aim to have the parentheses erased.</p>
<p>Therefore, they will be replaced with an empty text string. Our guess is, like our sample data here, the brackets in your data contain other text between them. Which is why the opening and closing parenthesis will have to be replaced one after the other to retain the contents within.</p>
<p>You have the idea; we can move on to the steps. Below are the details on using the <em>Find and Replace</em> feature to remove parentheses from data in Excel:</p>
<ul>
<li>On the worksheet, select the data that contains the parentheses you want to remove.</li>
<li>In the <em>Home</em> tab, click on the <em>Find &amp; Select</em> button from the <em>Editing</em> Select <em>Replace</em> from the drop menu. You can opt for the keyboard shortcut instead – press the <strong>Ctrl + H</strong> keys.</li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10438" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_02.png" alt="Using Find and Replace Feature" width="538" height="440" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 154"></li>
<li>In the <em>Find and Replace</em> dialog box, type the opening parenthesis in the <em>Find what</em></li>
<li>Hit the <em>Replace All</em> command button.</li>
<li>By doing this, you are leaving the <em>Replace with</em> field blank so that the parenthesis can be switched with blank text and consequently, removed.</li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10439" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_03.png" alt="Using Find and Replace Feature" width="459" height="334" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 155"></li>
<li>Click the <em>OK</em> button of the pop-up detailing the number of replacements made.</li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10440" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_04.png" alt="Using Find and Replace Feature" width="459" height="334" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 156"></li>
<li>Now you&#39;ll be back to the <em>Find and Replace </em>dialog box.</li>
<li>Empty the <em>Find what</em> field and enter the closing parenthesis this time.</li>
<li>Select the <em>Replace All</em></li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10441" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_05.png" alt="Using Find and Replace Feature" width="459" height="334" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 157"></li>
<li>The pop-up window will appear again with the text replacements.</li>
<li>Press the <strong>Esc</strong> key twice to close both dialog boxes.</li>
</ul>
<p>Returning to the worksheet, the selected data will now be free of the opening and closing parentheses:</p>
<img decoding="async" class="aligncenter size-full wp-image-10442" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_06.png" alt="Using Find and Replace Feature" width="459" height="313" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 158">
<p>Looking at our case example, suppose we want to slash away the parentheses and their contents which will leave us with just the city name instead of city, state. You can still take to <em>Find and Replace</em> for that. Simply enter the opening and closing brackets with an asterisk in between. The asterisk plays as a wildcard, covering any number of characters present between the parentheses. Enter (*) in the <em>Find what</em> box and make the replacements.</p>
<img decoding="async" class="aligncenter size-full wp-image-10443" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_07.png" alt="Using Find and Replace Feature" width="495" height="373" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 159">
<p>There we have removed the state name by replacing the parenthesis, contents included, with blank text:</p>
<img decoding="async" class="aligncenter size-full wp-image-10444" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_08.png" alt="Using Find and Replace Feature" width="367" height="313" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 160">
<p><strong>Notes:</strong></p>
<p>In this sample data above, we only have the city and state name separated by parentheses, without a comma. If the comma was there, in place of &quot;(*)&quot; we would have entered &quot;, (*)&quot; to eliminate the comma and space character along with the brackets and their contents.</p>
<p>The useful bit about using <em>Find and Replace</em> to remove the parentheses-enclosed contents is that the feature will find the position of the brackets automatically in a cell. Unlike the LEFT/RIGHT and FIND functions which remove the enclosed contents from the cell&#39;s left or right.</p>
<h2>Method #2 – Using SUBSTITUTE Function</h2>
<p>Use the <a href="https://exceltrick.com/functions/excel-substitute-function/">SUBSTITUTE function</a> in Excel to remove parentheses from your data. The SUBSTITUTE function is used to replace specific text with other text. That presents us with the perfect opportunity to switch the parentheses in the data out for blank text.</p>
<p>The function itself is straightforward and you don&#39;t have to replace the opening and closing parentheses one by one; they can both be replaced using a single formula. Given below is the formula used for removing parentheses in text values with the SUBSTITUTE function:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SUBSTITUTE</span>(<span class="function">SUBSTITUTE</span>(B2,"<span class="string">(</span>",""),"<span class="string">)</span>","")</code></div>
<p>For the ease of applying a single formula, we have used nested SUBSTITUTE functions. This way, we can add the opening and closing parentheses (enclosed in double quotes) as the values to be replaced by empty text string (denoted by twin double quotes &quot;&quot;). Starting with B2, we can see that the formula has worked fine with numeric text as well as alphabetic text in C2. We have the contact numbers without the area codes enclosed in brackets and the state names only separated by commas.</p>
<img decoding="async" class="aligncenter size-full wp-image-10445" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_09.png" alt="Using SUBSTITUTE Function" width="565" height="260" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 161">
<p>Copy-pasting the return values to the original dataset and clearing up the redundant columns gives us:</p>
<img decoding="async" class="aligncenter size-full wp-image-10446" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_10.png" alt="Using SUBSTITUTE Function" width="352" height="260" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 162">
<p><strong>Note: </strong>As per our case example, which contains a single instance of parentheses, we have left the <em>instance_num</em> argument empty. If, e.g., there are 2 sets of parentheses in a cell and you want the second set removed, enter the last argument of the SUBSTITUTE function as 2. Not defining this argument will remove both sets from the cell.</p>
<h2>Method #3 – Using LEFT &amp; FIND Function</h2>
<p>Find out how to remove parentheses and their contents in Excel with the LEFT and FIND functions. Use this option for clearing parentheses and their contained value from a cell. This is the function version of clearing the parentheses part of a cell as we have also seen with the <em>Find and Replace</em> feature.</p>
<p>The enclosed data is on the right side of the cell, and we need the <a href="https://exceltrick.com/functions/excel-find-function/">FIND function</a> to locate the opening parenthesis and return the value to the left of it. See the formula ahead which uses the LEFT and FIND functions to erase parentheses along with their contents:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">LEFT</span>(C3,<span class="function">FIND</span>("<span class="string">(</span>",C3,1)<span class="operator">-</span>1)</code></div>
<p>The FIND function searches the position of the opening bracket in C3 with the starting position of the search defined as 1 (i.e. FIND will begin its search from the first character of C3). The LEFT function is set to return the value in C3 that is on the left of the opening parenthesis. -1 in the end ensures that LEFT&#39;s return value is without the opening parenthesis itself. Here we have all the city names without the state name and its brackets:</p>
<img decoding="async" class="aligncenter size-full wp-image-10447" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_11.png" alt="Using LEFT &amp; FIND Function" width="523" height="313" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 163">
<p>If the bracketed value in your data is on the left, the formula will have to be tweaked to return the value to the right of the closing parenthesis. Here&#39;s a sample formula you can go by to remove parentheses and their contents from the left of a cell:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">RIGHT</span>(C3,<span class="function">LEN</span>(C3)<span class="operator">-</span><span class="function">FIND</span>("<span class="string">)</span>",C3)<span class="operator">-</span>1)</code></div>
<p>Since we need the value from the right, we incorporate the <a href="https://exceltrick.com/functions/excel-right-function/">RIGHT function</a>. The return value is to be the parentheses-free text in C3. The number of characters is set by the LEN and FIND functions where FIND gets the position of the closing bracket as 10 and LEN counts the total characters as 19.</p>
<p>Therefore, RIGHT delivers the 19-10 characters that are on the right side in C3. In column C, after the closing parenthesis, there is a space character which will also be returned as part of the value. To eliminate that, we have fixed a -1 in the end. The outcome of this formula is shown here:</p>
<img decoding="async" class="aligncenter size-full wp-image-10448" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_12.png" alt="Using LEFT &amp; FIND Function" width="523" height="313" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 164">
<h2>Method #4 – Using VBA Function</h2>
<p>Now we&#39;ll show you how to remove parentheses using <em>VBA</em> in Excel. <em>VBA </em>programs Office applications into performing tasks. For our case example, we can use a code in <em>VBA</em> to remove just the parentheses in the selected data without altering anything else. The code and the detailed steps for this task to be carried out in Excel are given ahead:</p>
<ul>
<li>Select the target data containing the parentheses.</li>
<li>Use the <em>Visual Basic </em>icon in the <a href="https://exceltrick.com/how-to/add-developer-tab-excel/">Developer tab&#39;s</a> <em>Code</em> group to launch the <em>Visual Basic</em> You can also use the <strong>Alt + F11</strong> keys to do this.</li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10449" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_13.png" alt="Using VBA Function" width="629" height="440" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 165"></li>
<li>In the editor, select the <em>Insert</em> Then select <em>Module</em> from the drop menu.</li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10450" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_14.png" alt="Using VBA Function" width="687" height="496" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 166"></li>
<li>You will now have access to a <em>Module</em> window.</li>
<li>In the <em>Module</em> window, copy-paste the code from below:</li>
<li class="no-bullets">
<div class="vbaFormula">
<pre style="margin: 0; line-height: 125%;"><span style="color: #008000; font-weight: bold;">Sub</span> <span style="color: #0000ff;">RemoveParentheses</span>()<br clear="none" /><span style="color: #008000; font-weight: bold;">Dim</span> ws <span style="color: #aa22ff; font-weight: bold;">As</span> Worksheet<br clear="none" /><span style="color: #008000; font-weight: bold;">Dim</span> rng <span style="color: #aa22ff; font-weight: bold;">As</span> Range<br clear="none" /><span style="color: #008000; font-weight: bold;">Dim</span> result <span style="color: #aa22ff; font-weight: bold;">As</span> Range<br clear="none" /><span style="color: #008000; font-weight: bold;">Set</span> ws <span style="color: #666666;">=</span> Application.ActiveSheet<br clear="none" /><span style="color: #008000; font-weight: bold;">Set</span> rng <span style="color: #666666;">=</span> Application.Selection<br clear="none" /><span style="color: #008000; font-weight: bold;">For</span> <span style="color: #008000; font-weight: bold;">Each</span> cell <span style="color: #aa22ff; font-weight: bold;">In</span> rng<br clear="none" />  cell.Value <span style="color: #666666;">=</span> Replace(cell.Value, <span style="color: #ba2121;">"("</span>, <span style="color: #ba2121;">""</span>)<br clear="none" />  cell.Value <span style="color: #666666;">=</span> Replace(cell.Value, <span style="color: #ba2121;">")"</span>, <span style="color: #ba2121;">""</span>)<br clear="none" /><span style="color: #008000; font-weight: bold;">Next</span><br clear="none" /><span style="color: #008000; font-weight: bold;">End</span> <span style="color: #008000; font-weight: bold;">Sub</span></pre>
</div>
<p>The code replaces both the opening and closing parentheses in the selected cells with blank text using the Replace function in <em>VBA</em>.<img decoding="async" class="aligncenter size-full wp-image-10451" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_15.png" alt="Using VBA Function" width="687" height="496" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 167"></li>
<li>Hit the <em>Run</em> button in the editor&#39;s toolbar (highlighted above) to activate the code.</li>
<li>The code will do its work in the background, on the worksheet.</li>
<li>Close the <em>Visual Basic</em></li>
</ul>
<p>All the selected data will be free of the parentheses:</p>
<img decoding="async" class="aligncenter size-full wp-image-10442" src="https://exceltrick.com/wp-content/uploads/2023/09/how-to-remove-parentheses-in-excel_06.png" alt="Using VBA Function" width="459" height="313" title="How to Remove Parentheses in Excel (3 Easy Ways + VBA) 168">
<p>Remove parentheses from data? Covered. Remove parentheses with their contents? Covered. Formula, tool, and <em>VBA</em> method? Covered, covered, covered. Yes, we&#39;ve got you covered with all the easy tricks. But this is just a bunch in a sea of many. So much remains uncovered. We&#39;ve all got our job cut out. Ready? Tricky? Go!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Extract Only Numbers From a Cell in Excel</title>
		<link>https://exceltrick.com/how-to/extract-only-numbers-from-cells-in-excel/</link>
		
		<dc:creator><![CDATA[Mehwish Javaid]]></dc:creator>
		<pubDate>Fri, 01 Sep 2023 07:20:00 +0000</pubDate>
				<category><![CDATA[How To's]]></category>
		<guid isPermaLink="false">https://exceltrick.com/?p=10410</guid>

					<description><![CDATA[Quite the probable setup for disappointment if you came here thinking there&#39;s a straightforward, dedicated function in Excel to help rake the numbers out of alphanumeric data. Given that Excel is a fancy number dealer, we were fairly surprised too. All the more reason to explore, right? We&#39;re not pointing you anywhere but here! A [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Quite the probable setup for disappointment if you came here thinking there&#39;s a straightforward, dedicated function in Excel to help rake the numbers out of alphanumeric data. Given that Excel is a fancy number dealer, we were fairly surprised too. All the more reason to explore, right? We&#39;re not pointing you anywhere but here!</p>
<p>A function may not be dedicated to the cause, but we are and we have 3 ways you can make numbers part way from your datasets. Do not be intimidated by the length of the formulas, (you only have to copy-paste, isn&#39;t that so?)</p>
<p>Any curiosity thirst will be quenched by the superfine minutiae of how the formulas work and alternatives to not having access to the later functions. We&#39;re going to crack this mystery and here&#39;s the cracker (or crackee, more like):</p>
<img decoding="async" class="aligncenter size-full wp-image-10416" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-extract-only-numbers-from-a-cell-in-excel_01.png" alt="how-to-extract-only-numbers-from-a-cell-in-excel_01" width="409" height="378" title="How to Extract Only Numbers From a Cell in Excel 181">
<p>Column B holds product codes in alphanumeric style. And not a consistent one. You can see that the numbers are at both ends in some categories and at one end in others. Let&#39;s say Company A wants to homogenize the codes for smooth data entry and readability of sales records.</p>
<p>Yes, number extraction is the mine work for today and the usual methods like <em>Text to Columns</em> cannot work because we&#39;re not dealing with a single format here.</p>
<p>All three methods given in this tutorial, as you will observe, can work on extracting numbers from values whether the numbers are interspersed or in different formats.</p>
<p>Extraction goggles on, let&#39;s go!</p>
<img decoding="async" class="aligncenter size-full wp-image-10415" src="https://exceltrick.com/wp-content/uploads/2023/08/Extract-Numbers-From-Cells-In-Excel.png" alt="How to Extract Only Numbers From a Cell in Excel" width="753" height="396" title="How to Extract Only Numbers From a Cell in Excel 182">
<h2>Method #1 – Using TEXTJOIN Function</h2>
<p>Use the <a href="https://exceltrick.com/functions/excel-textjoin-function/">TEXTJOIN function</a> to only extract numbers from a cell&#39;s value in Excel. The TEXTJOIN function combines a range of text strings. While that sounds like the converse of wanting to separate numbers, in effect, the TEXTJOIN will be used to <a href="https://exceltrick.com/how-to/concatenate-in-excel/">concatenate</a> the numbers dispersed in a text string.</p>
<p>Word of caution, skip to the next section if your Excel is older than 2019 or you are sans MS 365 subscription since the TEXTJOIN function is only available for the mentioned.</p>
<p>So now we make alphabetic strings disappear? Somewhat, yes. Find out how the formula below returns just the numeric part of a text string with the TEXTJOIN function:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">TEXTJOIN</span>("",TRUE,<span class="function">IFERROR</span>((<span class="function">MID</span>(B4,<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">1:</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),1)<span class="operator">*</span>1),""))</code></div>
<p>Firstly, the ROW and INDIRECT functions are used to generate a spill series of numbers from 1 to the number of characters in B4 (measured by the <a href="https://exceltrick.com/functions/excel-len-function/">LEN function)</a>. LEN counts the number of characters as 9 in this case. The &amp; operator makes this expression 1:9. The <a href="https://exceltrick.com/functions/excel-row-function/">ROW function</a> is used to return a row number and will take the reference from the <a href="https://exceltrick.com/functions/excel-indirect-function/">INDIRECT function</a>, making the spill values 1 to 9.</p>
<p>Then the MID function returns 1 character of B4 for every number spilled by the ROW and INDIRECT functions e.g. 1 returns the first character of B4 as &quot;5&quot;, 2 returns the second character as &quot;3&quot;. Therefore, this part of the formula returns the entire text string in B4 as a spill, readying each character to be checked separately as a number.</p>
<p>The <a href="https://exceltrick.com/functions/excel-iferror-function/">IFERROR function</a> loops through every character and multiples it by 1. The theory is that the numeric content of the spilled values can be multiplied by 1 and will return as they are.  A letter of the alphabet cannot be multiplied and will return an error.</p>
<p>When faced with an error, the IFERROR function will return blank text &quot;&quot;, ruling out the entire alphabetic string. What is left are the numbers and blank cells. Finally, the TEXTJOIN function collates the numbers by joining (without a delimiter) all the values left in the spill range, ignoring blank cells (set by &quot;TRUE&quot; in the second argument).</p>
<img decoding="async" class="aligncenter size-full wp-image-10417" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-extract-only-numbers-from-a-cell-in-excel_02.png" alt="Method #1 – Using TEXTJOIN Function" width="792" height="378" title="How to Extract Only Numbers From a Cell in Excel 183">
<p><strong>Note: </strong>After typing the whole formula, (for Excel 2010 – 2019), enter this array formula with the <strong>Ctrl + Shift + Enter</strong> keys. MS 365 users can just hit the <strong>Enter</strong> key as with regular formulas.</p>
<h2>Method #2 – Using Custom Formula</h2>
<p>Extract just the number component from a cell in Excel with the help of a formula. As mentioned, this formula is an alternative for non-Excel 2019 or MS 365 users since earlier Excel versions do not support the TEXTJOIN function.</p>
<p>The base of this formula is the same as the one above up until the MID function but additionally requires the IF, SUM, SUBSTITUTE, SUMPRODUCT, LARGE, INDEX, ISNUMBER to get similar results.</p>
<p>Since this takes up a little more space (subjectively) than other formulas, we&#39;ll break it down bit by bit. This is the formula, and the explanation follows:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">IF</span>(<span class="function">SUM</span>(<span class="function">LEN</span>(B4)<span class="operator">-</span><span class="function">LEN</span>(<span class="function">SUBSTITUTE</span>(B4, {"<span class="string">0</span>","<span class="string">1</span>","<span class="string">2</span>","<span class="string">3</span>","<span class="string">4</span>","<span class="string">5</span>","<span class="string">6</span>","<span class="string">7</span>","<span class="string">8</span>","<span class="string">9</span>"}, "")))<span class="operator">&gt;</span>0, <span class="function">SUMPRODUCT</span>(<span class="function">MID</span>(0<span class="operator">&amp;</span>B4, <span class="function">LARGE</span>(<span class="function">INDEX</span>(<span class="function">ISNUMBER</span>(<span class="operator">--</span><span class="function">MID</span>(B4,<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),1))<span class="operator">*</span> <span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),0), <span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))))<span class="operator">+</span>1,1) <span class="operator">*</span> 10<span class="operator">^</span><span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4)))<span class="operator">/</span>10),"")</code></div>
<p><strong>Breakdown</strong>:</p>
<p>For explanatory purposes and to tie everything in later, we&#39;ll call this section of the formula &quot;core calculation&quot;. It starts with the number series by the ROW and INDIRECT functions and ends with the <a href="https://exceltrick.com/functions/excel-sumproduct-function/">SUMPRODUCT function</a> so here we go.</p>
<div class="excelFormula"><code><span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4)))</code></div>
<p>Again starting with the ROW and INDIRECT functions, a series of numbers is generated from 1 to the number of characters in B4 which is 9. The ROW function places the consecutive numbers for the reference returned by the INDIRECT function. We get 9 rows of spilled number series starting from 1 like so: {1;2;3;4;5;6;7;8;9}</p>
<div class="excelFormula"><code><span class="function">MID</span>(B4,<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">1:</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),1)</code></div>
<p>Every number in this series is the starting point for the MID function for returning 1 character from the value in B4 as: {&quot;5&#8243;;&quot;3&#8243;;&quot;-&quot;;&quot;H&quot;;&quot;A&quot;;&quot;L&quot;;&quot;-&quot;;&quot;4&#8243;;&quot;1&quot;}</p>
<div class="excelFormula"><code><span class="function">ISNUMBER</span>(<span class="operator">--</span><span class="function">MID</span>(B4,<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),1))</code></div>
<p>Then there&#39;s the ISNUMBER function to check each character from the MID function as a number and return TRUE or FALSE:<br />
{TRUE;TRUE;FALSE;FALSE;FALSE;FALSE;FALSE;TRUE;TRUE}</p>
<div class="excelFormula"><code><span class="function">INDEX</span>(<span class="function">ISNUMBER</span>(<span class="operator">--</span><span class="function">MID</span>(B4,<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),1))<span class="operator">*</span> <span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),0)</code></div>
<p>Adding the double unary operator converts these Boolean values into 1 and 0 respectively, prepping to operate as an array formula for the INDEX function. Multiplying these 1s and 0s with the number series generated by the ROW and INDIRECT functions will give us the position of the numbers in the cells, the other characters will result in 0.</p>
<p>{1;2;0;0;0;0;0;8;9}</p>
<div class="excelFormula"><code><span class="function">LARGE</span>(<span class="function">INDEX</span>(<span class="function">ISNUMBER</span>(<span class="operator">--</span><span class="function">MID</span>(B4,<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),1))<span class="operator">*</span> <span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),0), <span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4)))</code></div>
<p>The LARGE function returns the kth <a href="https://exceltrick.com/how-to/find-max-value-in-range/">largest value</a>. K here is the number series from 1 to 9. Hence, we get INDEX&#39;s output in descending order. This will stack the zeros to one side, getting the position of the numbers together.</p>
<p>{9;8;2;1;0;0;0;0;0}</p>
<div class="excelFormula"><code><span class="function">MID</span>(0<span class="operator">&amp;</span>B4,<span class="function"> LARGE</span>(<span class="function">INDEX</span>(<span class="function">ISNUMBER</span>(<span class="operator">--</span><span class="function">MID</span>(B4,<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),1))<span class="operator">*</span> <span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),0), <span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))))<span class="operator">+</span>1,1)</code></div>
<p>The value the <a href="https://exceltrick.com/functions/excel-mid-function/">MID function</a> is using to return characters is 0&amp;B4, joining 0 to B4&#39;s value as the MID function returns the characters as per the defined positions (shown above). This added 0 and +1 as MID&#39;s second argument will help avoid the <a href="https://exceltrick.com/functions/value-error-excel/">#VALUE! error</a> which will arise when MID is to return the 0th position from B4. As of now, the 0th position will become 0+1 i.e. the 1st position which will return the concatenated 0.</p>
<p>{&quot;1&#8243;;&quot;4&#8243;;&quot;3&#8243;;&quot;5&#8243;;&quot;0&#8243;;&quot;0&#8243;;&quot;0&#8243;;&quot;0&#8243;;&quot;0&quot;}</p>
<div class="excelFormula"><code>10<span class="operator">^</span><span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4)))<span class="operator">/</span>10</code></div>
<p>Here&#39;s the masterstroke that begins flipping things around. This part of the function places a regular 10 and raises it to a power. The exponent is fed by the number series by ROW and INDIRECT going like 10<sup>1</sup>, 10<sup>2</sup>, and so on resulting in:<br />
{10;100;1000;10000;100000;1000000;10000000;100000000;1000000000}</p>
<p>Divided by 10 and we’re at:<br />
{1;10;100;1000;10000;100000;1000000;10000000;100000000}</p>
<div class="excelFormula"><code><span class="function">MID</span>(0<span class="operator">&amp;</span>B4,<span class="function">LARGE</span>(<span class="function">INDEX</span>(<span class="function">ISNUMBER</span>(<span class="operator">--</span><span class="function">MID</span>(B4,<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),1))<span class="operator">*</span><span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),0),<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))))<span class="operator">+</span>1,1)<span class="operator">*</span>10<span class="operator">^</span><span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4)))<span class="operator">/</span>10</code></div>
<p>You can see at the end of the formula that the &quot;10&quot; expression has been multiplied by the MID function and will result in: {1;40;300;5000;0;0;0;0;0}</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SUMPRODUCT</span>(<span class="function">MID</span>(0<span class="operator">&amp;</span>B4,<span class="function">LARGE</span>(<span class="function">INDEX</span>(<span class="function">ISNUMBER</span>(<span class="operator">--</span><span class="function">MID</span>(B4,<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">1:</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),1))<span class="operator">*</span><span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">1:</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),0),<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">1:</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))))<span class="operator">+</span>1,1)<span class="operator">*</span>10<span class="operator">^</span><span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">1:</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4)))<span class="operator">/</span>10)</code></div>
<p>This is where the core calculation ends. Have it known that we&#39;ve tried the SUM function in place of SUMPRODUCT with no problems. Anyhow, when the SUMPRODUCT function adds it up, we get (hallelujah) 5341 which is what we&#39;re looking for and you can very well stop here as the formula works fine to separate the numbers from a string and return them:</p>
<img decoding="async" class="aligncenter size-full wp-image-10418" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-extract-only-numbers-from-a-cell-in-excel_03.png" alt="Method #2 – Using Custom Formula" width="737" height="418" title="How to Extract Only Numbers From a Cell in Excel 184">
<p>The hitch arises if your input range also contains values that don&#39;t have any numbers. Let&#39;s show you what happens:</p>
<img decoding="async" class="aligncenter size-full wp-image-10419" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-extract-only-numbers-from-a-cell-in-excel_04.png" alt="Method #2 – Using Custom Formula" width="758" height="417" title="How to Extract Only Numbers From a Cell in Excel 185">
<p>We&#39;ve changed the top two product codes to be without numbers and the formula returns 0. The only problem is that the 0 can be mistaken to be the only number in the code. In that case, let&#39;s use the complete formula to give us empty text when there are no numbers in the input string. Moving on to further breakdowns.</p>
<div class="excelFormula"><code><span class="function">SUBSTITUTE</span>(B4, {"<span class="string">0</span>","<span class="string">1</span>","<span class="string">2</span>","<span class="string">3</span>","<span class="string">4</span>","<span class="string">5</span>","<span class="string">6</span>","<span class="string">7</span>","<span class="string">8</span>","<span class="string">9</span>"}, "")</code></div>
<p>Now the <a href="https://exceltrick.com/functions/excel-substitute-function/">SUBSTITUTE function</a> will replace any occurrence of the digits 0 to 9, one by one, in B4 with a blank space. This will spill in a horizontal range. Since B4 doesn&#39;t have any 0s, B4 will be returned as is. B4 does have the number 1 and so in the second value of the output, 1 will be replaced by a blank space. In this way, all the digits will be checked:<br />
{&quot;53-HAL-41&#8243;,&quot;53-HAL-4&#8243;,&quot;53-HAL-41&#8243;,&quot;5-HAL-41&#8243;,&quot;53-HAL-1&#8243;,&quot;3-HAL-41&#8243;,&quot;53-HAL-41&#8243;,&quot;53-HAL-41&#8243;,&quot;53-HAL-41&#8243;,&quot;53-HAL-41&quot;}</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">LEN</span>(<span class="function">SUBSTITUTE</span>(B4, {"<span class="string">0</span>","<span class="string">1</span>","<span class="string">2</span>","<span class="string">3</span>","<span class="string">4</span>","<span class="string">5</span>","<span class="string">6</span>","<span class="string">7</span>","<span class="string">8</span>","<span class="string">9</span>"}, ""))</code></div>
<p>The LEN function counts the number of characters in each value of the spilled result. With no 0, we had all 9 characters in the first value. In the second value, 1 was replaced by empty text, leaving 8 characters and so on.</p>
<p>{9,8,9,8,8,8,9,9,9,9}</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">LEN</span>(B4)<span class="operator">-</span><span class="function">LEN</span>(<span class="function">SUBSTITUTE</span>(B4,{"<span class="string">0</span>","<span class="string">1</span>","<span class="string">2</span>","<span class="string">3</span>","<span class="string">4</span>","<span class="string">5</span>","<span class="string">6</span>","<span class="string">7</span>","<span class="string">8</span>","<span class="string">9</span>"},""))</code></div>
<p>Subtract this result from the total number of characters, again counted by LEN. We get the number of missing characters and thus the count of numbers present in B4.</p>
<p>{0,1,0,1,1,1,0,0,0,0}</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SUM</span>(<span class="function">LEN</span>(B4)<span class="operator">-</span><span class="function">LEN</span>(<span class="function">SUBSTITUTE</span>(B4, {"<span class="string">0</span>","<span class="string">1</span>","<span class="string">2</span>","<span class="string">3</span>","<span class="string">4</span>","<span class="string">5</span>","<span class="string">6</span>","<span class="string">7</span>","<span class="string">8</span>","<span class="string">9</span>"}, "")))</code></div>
<p>To bring the tally together, the SUM function will suffice and result in 4.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">IF</span>(<span class="function">SUM</span>(<span class="function">LEN</span>(B4)<span class="operator">-</span><span class="function">LEN</span>(<span class="function">SUBSTITUTE</span>(B4, {"<span class="string">0</span>","<span class="string">1</span>","<span class="string">2</span>","<span class="string">3</span>","<span class="string">4</span>","<span class="string">5</span>","<span class="string">6</span>","<span class="string">7</span>","<span class="string">8</span>","<span class="string">9</span>"}, "")))<span class="operator">&gt;</span>0, <span class="function">SUMPRODUCT</span>(<span class="function">MID</span>(0<span class="operator">&amp;</span>B4, <span class="function">LARGE</span>(<span class="function">INDEX</span>(<span class="function">ISNUMBER</span>(<span class="operator">--</span><span class="function">MID</span>(B4,<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),1))<span class="operator">*</span> <span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),0), <span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))))<span class="operator">+</span>1,1) <span class="operator">*</span> 10<span class="operator">^</span><span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4)))<span class="operator">/</span>10),"")</code></div>
<p>And at last, the complete formula is brought together by the <a href="https://exceltrick.com/functions/excel-if-statement/">IF function</a>. In plain words, the formula says that if the count of numbers is not greater than zero, return empty text (see the last argument of the formula). If the count of numbers is greater than zero, perform core calculation. Since the count of numbers in B4 is 4 and is greater than 0, the core calculation has landed us at the final output which is 5341.</p>
<img decoding="async" class="aligncenter size-full wp-image-10420" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-extract-only-numbers-from-a-cell-in-excel_05.png" alt="Method #2 – Using Custom Formula" width="818" height="438" title="How to Extract Only Numbers From a Cell in Excel 186">
<p>B5 as shown above does not have numeric data and results in a blank cell now.</p>
<p><strong>Pro tip: </strong>Notice we have a few instances with only 3 digits extracted as Excel automatically <a href="https://exceltrick.com/how-to/remove-leading-zeros/">eliminates leading zeros from numbers</a>. A quick solution is to add the <a href="https://exceltrick.com/functions/excel-text-function/">TEXT function</a> to the formula so we can have the leading zeros without default removal. Use this formula to extract numbers from a cell and keep leading zeros:</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">TEXT</span>(<span class="function">IF</span>(<span class="function">SUM</span>(<span class="function">LEN</span>(B4)<span class="operator">-</span><span class="function">LEN</span>(<span class="function">SUBSTITUTE</span>(B4, {"<span class="string">0</span>","<span class="string">1</span>","<span class="string">2</span>","<span class="string">3</span>","<span class="string">4</span>","<span class="string">5</span>","<span class="string">6</span>","<span class="string">7</span>","<span class="string">8</span>","<span class="string">9</span>"}, "")))<span class="operator">&gt;</span>0, <span class="function">SUMPRODUCT</span>(<span class="function">MID</span>(0<span class="operator">&amp;</span>B4, <span class="function">LARGE</span>(<span class="function">INDEX</span>(<span class="function">ISNUMBER</span>(<span class="operator">--</span><span class="function">MID</span>(B4,<span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"&amp;LEN(B4))),1))* <span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))),0), <span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4))))<span class="operator">+</span>1,1) <span class="operator">*</span> 10<span class="operator">^</span><span class="function">ROW</span>(<span class="function">INDIRECT</span>("<span class="string">$1:$</span>"<span class="operator">&amp;</span><span class="function">LEN</span>(B4)))<span class="operator">/</span>10),""),"<span class="string">0000</span>")</code></div>
<p>The TEXT function has been added and the format we have supplied is &quot;0000&quot; to keep the resulting number at 4 digits even if it leads with 0s.</p>
<img decoding="async" class="aligncenter size-full wp-image-10421" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-extract-only-numbers-from-a-cell-in-excel_06.png" alt="Method #2 – Using Custom Formula" width="818" height="438" title="How to Extract Only Numbers From a Cell in Excel 187">
<h2>Method #3 – Using VBA</h2>
<p>Learn how to extract only numbers from a cell using <em>VBA</em> in Excel. <em>VBA</em> programming is used to automate tasks in Excel. By now you would know that there is no direct function in Excel that can get this job easily done for us. Thus, we shall plant a function on our own!</p>
<p>Using a code involving the IsNumeric function in <em>VBA</em>, we will set up a function to extract numbers from a range of text strings. The following steps will demonstrate in complete detail how to utilize <em>VBA</em> to get only numbers from a cell:</p>
<ul>
<li>Open the <em>Visual Basic</em> editor by pressing the <strong>Alt + F11</strong> If you have the <a href="https://exceltrick.com/how-to/add-developer-tab-excel/">Developer tab</a> enabled, you can also use the <em>Visual Basic</em> button in the <em>Deve</em>l<em>oper</em> tab&#39;s <em>Code</em> group.</li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10422" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-extract-only-numbers-from-a-cell-in-excel_07.png" alt="Method #3 – Using VBA" width="625" height="503" title="How to Extract Only Numbers From a Cell in Excel 188"></li>
<li>In the editor, click on the <em>Insert</em> tab and select <em>Module</em> from the drop-down menu.</li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10423" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-extract-only-numbers-from-a-cell-in-excel_08.png" alt="Method #3 – Using VBA" width="684" height="498" title="How to Extract Only Numbers From a Cell in Excel 189"></li>
<li>Copy and paste this code from below in the <em>Module</em> window:</li>
<li class="no-bullets">
<div class="vbaFormula">
<pre style="margin: 0; line-height: 125%;"><span style="color: #008000; font-weight: bold;">Function</span> <span style="color: #0000ff;">ExtractNumbers</span>(CellRef <span style="color: #aa22ff; font-weight: bold;">As</span> <span style="color: #b00040;">String</span>)<br clear="none" /><span style="color: #008000; font-weight: bold;">Dim</span> StringLength <span style="color: #aa22ff; font-weight: bold;">As</span> <span style="color: #b00040;">Integer</span><br clear="none" />StringLength <span style="color: #666666;">=</span> Len(CellRef)<br clear="none" /><span style="color: #008000; font-weight: bold;">For</span> i <span style="color: #666666;">=</span> <span style="color: #666666;">1</span> <span style="color: #008000; font-weight: bold;">To</span> StringLength<br clear="none" />  <span style="color: #008000; font-weight: bold;">If</span> IsNumeric(Mid(CellRef, i, <span style="color: #666666;">1</span>)) <span style="color: #008000; font-weight: bold;">Then</span> Result <span style="color: #666666;">=</span> Result <span style="color: #666666;">&amp;</span> Mid(CellRef, i, <span style="color: #666666;">1</span>)<br clear="none" />  <span style="color: #008000; font-weight: bold;">Next</span> i<br clear="none" />ExtractNumbers <span style="color: #666666;">=</span> Result<br clear="none" /><span style="color: #008000; font-weight: bold;">End</span> <span style="color: #008000; font-weight: bold;">Function</span></pre>
</div>
<p>The code uses the Mid function to operate with the IsNumeric function in <em>VBA</em> to extract numbers from within a cell&#39;s value. The function name in the first line of the code (&quot;ExtractNumbers&quot; in this case) is the name you will use on the worksheet so be mindful of that.<img decoding="async" class="aligncenter size-full wp-image-10424" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-extract-only-numbers-from-a-cell-in-excel_09.png" alt="Method #3 – Using VBA" width="684" height="498" title="How to Extract Only Numbers From a Cell in Excel 190"></li>
<li>After inserting the code, close the <em>Visual Basic</em></li>
<li>Enter the function name in the target cell on the worksheet and it will show up in <em>IntelliSense</em>.</li>
<li class="no-bullets"><img decoding="async" class="aligncenter size-full wp-image-10425" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-extract-only-numbers-from-a-cell-in-excel_10.png" alt="Method #3 – Using VBA" width="407" height="378" title="How to Extract Only Numbers From a Cell in Excel 191"></li>
<li>Select the function and refer the cell containing the text string you want to extract numbers from.</li>
</ul>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">ExtractNumbers</span>(B4)</code></div>
<p>Enter the function and it will extract the numbers from the relevant cell:</p>
<img decoding="async" class="aligncenter size-full wp-image-10426" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-extract-only-numbers-from-a-cell-in-excel_11.png" alt="Method #3 – Using VBA" width="407" height="378" title="How to Extract Only Numbers From a Cell in Excel 192">
<p>And that readers, is how numbers are extracted from a cell in some handy Excel ways. More handyman Excel services are coming up your way giving you all the fine tools to chisel your way through with just the perfect Excel trick. Ready? Tricky? Go!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Excel TAKE Function – How To Use</title>
		<link>https://exceltrick.com/functions/excel-take-function/</link>
		
		<dc:creator><![CDATA[Shubhra Jain]]></dc:creator>
		<pubDate>Mon, 28 Aug 2023 06:27:00 +0000</pubDate>
				<category><![CDATA[Functions]]></category>
		<guid isPermaLink="false">https://exceltrick.com/?p=10378</guid>

					<description><![CDATA[The TAKE function allows us to extract a subset of ranges or arrays from a bigger dataset. The function is especially useful when dealing with large datasets as it makes data manipulation and extraction easier and faster. While using the TAKE function, the user can choose the number of rows or columns to be extracted [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The TAKE function allows us to extract a subset of ranges or arrays from a bigger dataset. The function is especially useful when dealing with large datasets as it makes data manipulation and extraction easier and faster.</p>
<p>While using the TAKE function, the user can choose the number of rows or columns to be extracted from the beginning or the end of the array.</p>
<img decoding="async" class="aligncenter size-full wp-image-10383" src="https://exceltrick.com/wp-content/uploads/2023/08/Excel-TAKE-Function.png" alt="Excel TAKE Function" width="753" height="396" title="Excel TAKE Function – How To Use 216">
<h2>Syntax</h2>
<p>The syntax of the TAKE function consists of three arguments and is structured as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">TAKE</span>(array, rows, [cols])</code></div>
<p style="margin: 0px;"><strong>Arguments:</strong></p>
<p>The TAKE function accepts two mandatory arguments while the third is optional. The role of each input argument is stated below.</p>
<p style="padding-left: 30px;">&#39;<em>array</em>&#39; &#8211; This is the first and only mandatory argument of the TAKE function. It accepts the value of the original cell range or array from which we wish to extract the rows or columns. The input value of the <em>array </em>argument can also be a static array or a return value from another function.</p>
<p style="padding-left: 30px;">&#39;<em>rows</em>&#39; &#8211; This is a mandatory argument that indicates the number of rows we wish to extract from the original The argument must be mentioned in the formula (by way of a comma) even if it is left empty. When the value of the <em>rows </em>argument is left empty, the TAKE function returns all the rows from the original array.</p>
<p style="padding-left: 30px;">Another aspect of the <em>rows </em>argument is if the input value is a positive number, the function retrieves the row(s) from the top of the array. Conversely, when a negative value is given, it extracts row(s) from the bottom of the array.</p>
<p style="padding-left: 30px;">&#39;<em>cols</em>&#39; &#8211; This is an optional argument that accepts the value of the number of columns to be extracted from the input The positive value of the <em>cols</em> argument indicates that the TAKE function will extract the column(s) from the left of the array. Meanwhile, a negative value suggests that column(s) must be extracted from right to left. If the <em>cols</em> argument is left empty, the function returns all the column(s) from the input array.</p>
<h2>Important Characteristics of the TAKE Function</h2>
<p>One of the basic features of the TAKE function is that it creates a new array containing the specified rows and columns. Furthermore, the TAKE function offers several notable features, outlined below.</p>
<ul>
<li>If the value of the <em>rows</em> or <em>cols</em> argument is greater than the input <em>array</em>, the TAKE function returns all the rows or columns of the complete input <em>array</em>.</li>
<li>If the input <em>array </em>is empty, the TAKE function returns an array of 0s depending on the rows and columns argument.</li>
<li>When the array argument is left empty, the function throws a <a href="https://exceltrick.com/functions/value-error-excel/">#VALUE! error</a>.</li>
<li>When the <em>rows</em> or <em>cols </em>argument is set to 0, the TAKE function results in a <a href="https://exceltrick.com/functions/calc-error-excel/">#CALC! error</a>.</li>
</ul>
<p>With the aforementioned features in consideration, let&#39;s move on to comprehending the workings of the TAKE function and how it interacts with data.</p>
<h2>Examples of TAKE Function</h2>
<p>To better understand the TAKE function in Excel, let&#39;s start by using different input values for each argument to demonstrate how it functions and the outcomes it produces. This will help us grasp its mechanics and utility more comprehensively.</p>
<p>Here, we have taken a small dataset that consists of 3 rows and columns.</p>
<img decoding="async" class="aligncenter size-full wp-image-10384" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_01.png" alt="Examples of TAKE Function" width="269" height="349" title="Excel TAKE Function – How To Use 217">
<p>In the first example, only the input value for the first two arguments is used, and the <em>cols </em>argument is left empty. As a result, the TAKE function extracts the first 2 rows from the range B1:D2, while returning all columns.</p>
<p>The next example showcases the same logic but for columns. Here, as observed, we have skipped the input value for the <em>rows</em> argument. As intended, the function extracted all rows and the first 2 columns from the range B1:D3.</p>
<p>The subsequent instance is a classic example where the input values for all arguments are used. The TAKE function considers the number of rows and columns and extracts the first row and 2 columns from the given dataset.</p>
<p>In the last example, as the input values for both the<em> rows</em> and <em>cols</em> arguments are empty, the TAKE function simply returns the entire input range B1:D3 as the output.</p>
<p>Now that the basic functionality of the TAKE function is clear, let&#39;s explore more examples to showcase its capabilities to retrieve specific portions of information from larger datasets.</p>
<h3>Example 1 &#8211; Simple Use of the TAKE Function</h3>
<p>Suppose you are organizing a few workshops that have limited seating and follow a first come, first serve enrollment process. Due to its popularity, you have received several applicants which are now stored in an Excel dataset that includes information such as the applicant&#39;s names, contact details, workshop preferences, and enrollment timestamps.</p>
<p>After the application period concludes, you intend to extract the first 5 applicants as they are sorted as per enrollment timestamp and notify them about their application status.</p>
<img decoding="async" class="aligncenter size-full wp-image-10385" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_02.png" alt="Example 1 - Simple Use of the TAKE Function" width="611" height="350" title="Excel TAKE Function – How To Use 218">
<p>Using the TAKE function, we can easily extract the first 5 applicants and the relevant columns. Subsequently, we can leverage the extracted subset for any further use. The function used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">TAKE</span>(A1:D16,6,<span class="operator">-</span>3)</code></div>
<p>This will extract the first 6 rows from the dataset A1:D16 along with the last 3 columns as we do not need the enrollment timestamps column. We are extracting the first 6 rows which include the row header and the first 5 applicants.</p>
<img decoding="async" class="aligncenter size-full wp-image-10386" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_03.png" alt="Example 1 - Simple Use of the TAKE Function" width="559" height="470" title="Excel TAKE Function – How To Use 219">
<p>This exemplifies a classic application of the TAKE function. Let&#39;s delve deeper to uncover additional scenarios where the same function proves valuable.</p>
<h3>Example 2 – Calculating Average of Last N Numbers with TAKE Function</h3>
<p>Suppose we wish to analyze the stock prices of a company over a period, and we want to calculate the average closing price of the last N trading days to identify recent price trends. We downloaded the stock price trading data which keeps updating each day.</p>
<img decoding="async" class="aligncenter size-full wp-image-10387" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_04.png" alt="Example 2 – Calculating Average of Last N Numbers with TAKE Function" width="316" height="252" title="Excel TAKE Function – How To Use 220">
<p>We can use the TAKE function to extract the last N days of data and then use the AVERAGE function to calculate the average. Let&#39;s say we wish to calculate the average closing price for the last 5 days. The formula to extract the intended values will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">TAKE</span>(A1:E11,<span class="operator">-</span>5,<span class="operator">-</span>1)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10388" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_05.png" alt="Example 2 – Calculating Average of Last N Numbers with TAKE Function" width="473" height="290" title="Excel TAKE Function – How To Use 221">
<p>Now we can simply use the AVERAGE function as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">AVERAGE</span>(<span class="function">TAKE</span>(A1:E11,<span class="operator">-</span>5,<span class="operator">-</span>1))</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10389" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_06.png" alt="Example 2 – Calculating Average of Last N Numbers with TAKE Function" width="507" height="316" title="Excel TAKE Function – How To Use 222">
<p>We have obtained the desired average closing price, but it&#39;s important to acknowledge a limitation in this approach. With the stock price dataset expanding daily, the formula needs to be adaptable and encompass the newly added rows to remain effective.</p>
<p>There are two ways we can achieve that. One way is to format the existing dataset as a <em>Table </em>in Excel. Select the dataset which is $A$1:$E$11 and press the <strong>Ctrl + T</strong> shortcut. Alternatively, choose <em>Format as Table</em> option from the <em>Home</em> Tab.</p>
<img decoding="async" class="aligncenter size-full wp-image-10390" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_07.png" alt="Example 2 – Calculating Average of Last N Numbers with TAKE Function" width="313" height="419" title="Excel TAKE Function – How To Use 223">
<p>After we press <em>OK,</em> the table is created. Now, to rename the table as per your preference, go to the <em>Table Design</em> tab, select the existing name in the <em>Table Name</em> box, and overwrite it with a new one. We have named it &#39;stockprice&#39;.</p>
<img decoding="async" class="aligncenter size-full wp-image-10391" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_08.png" alt="Example 2 – Calculating Average of Last N Numbers with TAKE Function" width="331" height="413" title="Excel TAKE Function – How To Use 224">
<p>Now the formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">AVERAGE</span>(<span class="function">TAKE</span>(stockprice,<span class="operator">-</span>5,<span class="operator">-</span>1))</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10392" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_09.png" alt="Example 2 – Calculating Average of Last N Numbers with TAKE Function" width="523" height="334" title="Excel TAKE Function – How To Use 225">
<p>As we can see, an additional row has been added and the formula dynamically encompasses the most recent 5 rows.</p>
<p>Another way to achieve this is by combining the <a href="https://exceltrick.com/functions/excel-filter-function/">FILTER function</a> with the TAKE function. We can include the entire column E as the input <em>array </em>and FILTER the range of cells that are non-empty. We can then use the TAKE function on the filtered data and extract the last 5 values.</p>
<p>The function will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">TAKE</span>(<span class="function">FILTER</span>(E:E,E:E<span class="operator">&lt;&gt;</span>""),<span class="operator">-</span>5)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10393" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_10.png" alt="Example 2 – Calculating Average of Last N Numbers with TAKE Function" width="448" height="293" title="Excel TAKE Function – How To Use 226">
<p>Now, we can easily calculate the average of the filtered data. The formula will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">AVERAGE</span>(<span class="function">TAKE</span>(<span class="function">FILTER</span>(E:E,E:E<span class="operator">&lt;&gt;</span>""),<span class="operator">-</span>5))</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10394" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_11.png" alt="Example 2 – Calculating Average of Last N Numbers with TAKE Function" width="524" height="329" title="Excel TAKE Function – How To Use 227">
<p>As observed, we now have the average closing price for the last 5 days and the formula remains unaffected even after incorporating an additional row. As a practice, try to use the combination of FILTER and TAKE functions to extract the last day&#39;s data when the High price was more than 115.</p>
<h3>Example 3 – Using SORTBY and TAKE Function</h3>
<p>Suppose you have a dataset containing movie titles, user ratings, release years, and genres. You now wish to extract the highest and lowest-rated movies within different genres from a huge dataset.</p>
<img decoding="async" class="aligncenter size-full wp-image-10395" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_12.png" alt="Example 3 – Using SORTBY and TAKE Function" width="531" height="315" title="Excel TAKE Function – How To Use 228">
<p>To achieve this, we will begin by sorting the dataset based on user ratings. Subsequently, we will use the TAKE function to extract both the top and bottom movie names.</p>
<p>The following formula will rearrange the &quot;Movie Title&quot; column (A2:A16) based on the corresponding user ratings in the &quot;User Rating&quot; column (B2:B16) in descending order (-1). This means the movies will be arranged from highest to lowest user ratings.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SORTBY</span>(A2:A16,B2:B16,<span class="operator">-</span>1)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10396" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_13.png" alt="Example 3 – Using SORTBY and TAKE Function" width="437" height="352" title="Excel TAKE Function – How To Use 229">
<p>We can now easily extract the first and last movie names from the sorted data indicating the highest and lowest rated. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">TAKE</span>(<span class="function">SORTBY</span>(A2:A16,B2:B16,<span class="operator">-</span>1),1) <span class="comment">//highest rated</span><br />
<span class="operator">=</span><span class="function">TAKE</span>(<span class="function">SORTBY</span>(A2:A16,B2:B16,<span class="operator">-</span>1),<span class="operator">-</span>1) <span class="comment">//lowest rated</span></code></div>
<img decoding="async" class="aligncenter size-full wp-image-10397" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_14.png" alt="Example 3 – Using SORTBY and TAKE Function" width="589" height="360" title="Excel TAKE Function – How To Use 230">
<p>Let&#39;s go a step further and get rid of the need to use two different formulas. This can be achieved by using an array as an input for <em>rows</em>. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">TAKE</span>(<span class="function">SORTBY</span>(A2:A16,B2:B16,<span class="operator">-</span>1),{1;<span class="operator">-</span>1})</code></div>
<p>The array input {1; -1} tells the TAKE function to extract the first and last row from the sorted array. The semicolon will spill the result vertically.</p>
<img decoding="async" class="aligncenter size-full wp-image-10398" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_15.png" alt="Example 3 – Using SORTBY and TAKE Function" width="590" height="357" title="Excel TAKE Function – How To Use 231">
<h3>Example 4 &#8211; Using TAKE Function on Separate Datasets</h3>
<p>Imagine you own a retail store that sells electronics, clothing, and home goods. You now have sales data for different products under each category, organized in separate datasets. The aim is to identify the top 3 selling products across all categories for a special promotional campaign.</p>
<img decoding="async" class="aligncenter size-full wp-image-10399" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_16.png" alt="Example 4 - Using TAKE Function on Separate Datasets" width="265" height="383" title="Excel TAKE Function – How To Use 232">
<p>As there are separate datasets for each category, the first step is to use the <a href="https://exceltrick.com/functions/excel-vstack-function/">VSTACK function</a> to vertically combine the three category datasets, creating a merged dataset. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">VSTACK</span>(A3:C6,A10:C13,A17:C20)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10400" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_17.png" alt="Example 4 - Using TAKE Function on Separate Datasets" width="503" height="415" title="Excel TAKE Function – How To Use 233">
<p>Now, we can reorder the combined dataset using the SORT function based on the <em>Units Sold </em>column (column 2) in descending order (-1). The formula will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">SORT</span>(<span class="function">VSTACK</span>(A3:C6,A10:C13,A17:C20),2,<span class="operator">-</span>1)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10401" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_18.png" alt="Example 4 - Using TAKE Function on Separate Datasets" width="547" height="415" title="Excel TAKE Function – How To Use 234">
<p>Now, the dataset is sorted in a manner where the product with the highest quantity of units sold is on the top. In the final step, we can use the TAKE function to extract the first 3 rows indicating the top 3 selling products. The final formula will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">TAKE</span>(<span class="function">SORT</span>(<span class="function">VSTACK</span>(A3:C6,A10:C13,A17:C20),2,<span class="operator">-</span>1),3)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10402" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_19.png" alt="Example 4 - Using TAKE Function on Separate Datasets" width="595" height="417" title="Excel TAKE Function – How To Use 235">
<p>The same logic can be used to combine data from different worksheets or combine them horizontally using <a href="https://exceltrick.com/functions/excel-hstack-function/">HSTACK function</a> and then use the TAKE function to extract the desired data.</p>
<h2>TAKE Function vs DROP Function</h2>
<p>Suppose you have a dataset related to soccer league standings of various teams. The data includes details such as team name, matches played, number of wins, draws, losses, and the points earned by each team. The aim is to extract the top 5 teams in the standings and remove the last 5 teams.</p>
<img decoding="async" class="aligncenter size-full wp-image-10403" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_20.png" alt="TAKE Function vs DROP Function" width="328" height="392" title="Excel TAKE Function – How To Use 236">
<p>As we already know, the TAKE function can be used to extract the required rows and columns. Therefore, we can use the TAKE function to extract the top 5 rows representing the top teams. The formula used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">TAKE</span>(A1:F17,6)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10404" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_21.png" alt="TAKE Function vs DROP Function" width="609" height="385" title="Excel TAKE Function – How To Use 237">
<p>On the contrary, the <a href="https://exceltrick.com/functions/excel-drop-function/">DROP function</a> can be used to remove the required rows and columns. So, we can utilize the DROP function in this case and remove the last 5 teams which have the minimum points. The function used will be as follows.</p>
<div class="excelFormula"><code><span class="operator">=</span><span class="function">DROP</span>(A1:F17,<span class="operator">-</span>5)</code></div>
<img decoding="async" class="aligncenter size-full wp-image-10405" src="https://exceltrick.com/wp-content/uploads/2023/08/how-to-use-take-function-in-excel_22.png" alt="TAKE Function vs DROP Function" width="617" height="387" title="Excel TAKE Function – How To Use 238">
<p>The function, therefore, excluded the last five rows indicated by the negative input value.</p>
<p>Both the TAKE and DROP functions showcase complementary features used in data manipulation in Excel where in both cases we can extract a subset from a larger data. One function retains the data while the other removes it.</p>
<p>The TAKE function helps us retrieve the desired rows and columns, yet its constraint lies in its exclusive extraction of neighboring rows and columns. To extract non-adjacent rows or columns, we can use the <a href="https://exceltrick.com/functions/excel-chooserows-function/">CHOOSEROWS function</a> or <a href="https://exceltrick.com/functions/excel-choosecols-function/">CHOOSECOLS function</a>.</p>
<p>Delve deeper into the manifold applications of the TAKE function and unlock its versatile potential to elevate both your Excel proficiency and data analysis skills. Meanwhile, we bring to you yet another Excel function to expand your repertoire of tools and techniques.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>

<!-- plugin=object-cache-pro client=phpredis metric#hits=4613 metric#misses=4 metric#hit-ratio=99.9 metric#bytes=1938408 metric#prefetches=294 metric#store-reads=20 metric#store-writes=4 metric#store-hits=302 metric#store-misses=2 metric#sql-queries=8 metric#ms-total=923.86 metric#ms-cache=82.60 metric#ms-cache-avg=3.5915 metric#ms-cache-ratio=8.9 -->
