In this article, we will learn How to Index & sort values using the helper column in Excel.
Sometimes working with unmannerly data. We need to get the shorter version as required data from the table data based on the helper column. Here first we will understand how to get the helper column and then get the sorted small required data based on the table data.
How to index values in range ?
For this article we will be required to use the COUNTIF function. Now we will make a formula out of the function. Here given text and number mixed values in a range. We need to Index them in ascending order first numerically then alphabetically.
|= COUNTIF ( list , "<=" & f_value ) + ( COUNT (list) * ISTEXT (f_value) )|
list : list of numbers and text
f_value : first value of the range
All of these might be confusing to understand. Let's understand how to get the helper column using the explained formula. Here the helper column to be based on the sorting values in order (first numbers and then alphabatically). For this we will use the formula to get the Index or rank column as helper column for the Expense data shown below.
Here to find the values in range. For calculation purposes we use the named range for the fixed array D5:D12 as expense.
Use the formula:
|= COUNTIF ( expense , "<=" & D5 ) + ( COUNT (expense) * ISTEXT (D5) )|
The formula looks like as shown in the above snapshot. The value and array is given as named range and cell reference in the formula.
As you can see the Index of the first cell in range comes out to be 5 which means if we place the Expenses in sorting order, Electricity will be placed at 5th position. Now copy the formula in other cells using the drag down option or using the shortcut key Ctrl + D as shown below to get the Index or rank for the rest of the values.
As you can see, now we have a list of index or rank which is sorting manner of the Expenses. Now we will use this Rank column as helper column so as to get the shorter version of the table having the same order in the new list or table.
How to sort values using helper column in Excel?
Sort number in excel using the helper column must have index numbers and required range to sort. Helper column can be any required order. For example, if you need to get the list in required random order just place the rank corresponding to the value in the index or rank column which will work as helper column.
Now we will make a formula using the above functions. MATCH function will return the index of the lowest match from the range. The INDEX function takes the row index as an argument and returns its corresponding required results. This function finds the
|= INDEX ( return_array , MATCH ( ROWS (relative_reference) , Index , 0 ) )|
return_array : array to return value from
Relative reference : generates a ascending order in the formula. Can be used with any array
Index : Index array of the table
0 : exact match
All of these might be confusing to understand. So, let's understand this formula via running it on the example shown below. Here we ranked the data in random order to get the first three values based on Index column. Use the formula to get the first value of the required short table.
Use the formula:
|= INDEX ( B5:B13 , MATCH ( ROWS (D5:D5),D5:D13,0))|
The formula looks like as shown in the above snapshot. The value array is given as named range and cell reference.
As you can see the first value is the number from the range comes out to be "Milk" corresponding index is 1. Now copy the formula in other cells using the drag down option or using the shortcut key Ctrl + D as shown below to get the rest of the values.
As you can see values are indexed in ascending order. We obtained all the values as it also proves the formula works fine. We can extract the number values using the formula the same formula.
As you can se we have the shorter and sorted values from the table using the helper column which is indexed accordingly.
Here are some observational notes shown below.
Hope this article about How to Index and sort values with helper column in Excel is explanatory. Explore more articles on lookup formulas in Excel here. If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook. We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at email@example.com
How to use the SUMPRODUCT function in Excel: Returns the SUM after multiplication of values in multiple arrays in excel.
SUM if date is between : Returns the SUM of values between given dates or period in excel.
Sum if date is greater than given date: Returns the SUM of values after the given date or period in excel.
2 Ways to Sum by Month in Excel: Returns the SUM of values within a given specific month in excel.
How to Sum Multiple Columns with Condition: Returns the SUM of values across multiple columns having condition in excel
How to use wildcards in excel : Count cells matching phrases using the wildcards in excel
50 Excel Shortcut to Increase Your Productivity : Get faster at your task. These 50 shortcuts will make you work even faster on Excel.
How to use the VLOOKUP Function in Excel : This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.
How to use the COUNTIF function in Excel : Count values with conditions using this amazing function. You don't need to filter your data to count specific values. Countif function is essential to prepare your dashboard.
How to Use SUMIF Function in Excel : This is another dashboard essential function. This helps you sum up values on specific conditions.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.