Bạn đang xem bài viết How To Find Column Index Number From Table In Excel được cập nhật mới nhất trên website Hoisinhvienqnam.edu.vn. Hy vọng những thông tin mà chúng tôi đã chia sẻ là hữu ích với bạn. Nếu nội dung hay, ý nghĩa bạn hãy chia sẻ với bạn bè của mình và luôn theo dõi, ủng hộ chúng tôi để cập nhật những thông tin mới nhất.
Scenario:
Many times when working with long scattered data, we need to first clean data before working on it. It takes time and you just wanted to extract some queries. To extract data, you generally use the VLOOKUP function . But when we have long data with many column fields, then it gets messy because VLOOKUP function requires the correct column index as number, or else the formula returns error. Right there, below is the formula explanation for this kind of problem.
How to solve the problem?
For this we will use the MATCH function . If you haven’t heard of this function, get used to it. It is an excel lookup function which returns the Index of the lookup value in the array. Here we need to get Index number of the column name. Then we will proceed to further step How to lookup values in tables using the MATCH function. Below is the Generic formula
Generic formula:
column_name : lookup value
table_header : table header array
0 : lookup for exact match
Example :
All of these might be confusing to understand. Let’s understand the formula with explanation and example. Here we have a data table in Sheet 1 ($A$1:$U$9995). So we have the table header as A1:U1 (The first row of the table).
Use the formula
Explanation:
MATCH function looks up value in C4 cell “Order ID”
Sheet1!$A$1:$U$1 is the lookup array argument.
0 argument is given to look up for exact match.
Use the formula.
MATCH index in VLOOKUP function:
Now we have the solution for, how to get the column index of the table. We can use the formula as input to the VLOOKUP function. For example, we need the product name bought by the customer name “Pete Kriz”.
Use the formula:
Note: make sure lookup value in D10 (Pete Kriz) must be in the first column of the table.
Here are all the observational notes regarding using the formula.
Notes:
The formula works for text and numbers both.
The function returns the #NA error if the lookup array argument to the MATCH function is not of the same length of the table array.
The formula returns an error if lookup_value doesn’t match the value in the table lookup_array.
The function matches the exact value as the match type argument to the MATCH function is 0.
Use the argument -1 for less than, 0 for exact match and 1 for the greater than the lookup match.
The lookup values can be given as cell reference or directly using quote symbol ( ” ) in the formula as arguments.
Hope you understood How to extract the column index from the table in Excel. Explore more articles on Excel lookup value & Excel 2023 functions here. If you liked our blogs, share it with your friends on . And also you can follow us on and . 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 to us at info@exceltip.com .
Related Articles Popular Articles:
How To Alphabetize In Excel: Sort Alphabetically Columns And Rows
This tutorial will teach you a few quick and easy ways to put Excel in alphabetical order. It also provides solutions for non-trivial tasks, for example how to alphabetize by last name when the entries start with the first name.
This tutorial will show you a few quick ways to alphabetize in Excel and teach how to foresee and prevent sorting problems.
How to alphabetize in ExcelOverall, there are 3 main ways to sort alphabetically in Excel: A-Z or Z-A button, the Sort feature, and filter. Below you will find the detailed guidance on each method.
How to sort a column alphabeticallyThe fastest way to sort alphabetically in Excel is this:
Select any cell in the column you want to sort.
Either way, Excel will alphabetize your list instantaneously:
Alphabetize and keep rows togetherIf your data set contains two or more columns, you can use the A-Z or Z-A button to put one of the columns in alphabetical order and Excel will automatically move the data in other columns, keeping the rows intact.
As you can see in the sorted table on the right, the related information in each row is kept together:
Filter and alphabetize in ExcelAdding a filter to your table is easy:
Select one or several column headers.
The column is alphabetized straight away, and a small upward arrow on the filter button indicates the sorting order (ascending):
To reverse the order, select Sort Z to A from the filter drop-down menu.
How to put multiple columns in alphabetical orderIn case you want to alphabetize data in several columns, use the Excel Sort command, which gives more control over how your data is sorted.
As an example, let’s add one more column to our table, and then arrange the entries alphabetically first by Region, and then by Name:
To have it done, please perform the following steps:
Select the entire table you want to sort.
In most cases, you can select just one cell and Excel will pick the rest of your data automatically, but this is an error-prone approach, especially when there are some gaps (blank cells) within your data.
The Sort dialog box will show up with the first sorting level created for you automatically as Excel sees fit.
In the Sort by dropdown box, select the column you want to alphabetize first, Region in our case. In the other two boxes, leave the default settings: Sort On – Cell values and Order – A to Z:
Tip. If the first dropdown is showing column letters instead of headings, tick off the My data has headers box.
In this example, the second level sorts the values in the Name column alphabetically from A to Z:
Excel will sort your data in the specified order. As shown in the screenshot below, our table is arranged alphabetically exactly as it should: first by Region, and then by Name:
How to sort rows alphabetically in ExcelIf your data is arranged horizontally, you may want to sort it alphabetically across rows. This can also be done by using the Excel Sort feature. Here’s how:
Select the range you want to sort. If your table has row labels that should not be moved, be sure to leave them out.
As the result, the first row in our table is sorted in alphabetical order, and the rest of the data is rearranged accordingly, preserving all correlations between the entries:
Problems with sorting alphabetically in ExcelExcel sort features are amazing, but if you are working with an imperfectly structured data, things may go terribly wrong. Here are the two common issues.
Blank or hidden columns and rowsAn easy fix is to eliminate the blanks and unhide all hidden areas before sorting. Or, select the entire table first, and then alphabetize.
Unrecognizable column headersIf your column headers are formatted differently from the rest of the data, Excel is smart enough to identify them and exclude from sorting. But if the header row has no special formatting, your column headers will most likely be treated as regular entries and end up somewhere in the middle of the sorted data. To prevent this from happening, select only the data rows, and then sort.
When using the Sort dialog box, make sure the My data has headers checkbox is selected.
How to sort alphabetically in Excel with formulasMicrosoft Excel provides a variety of features to cope with many different tasks. Many, but not all. If you are facing a challenge for which there is no built-in solution, chances are it can be accomplished with a formula. It is also true for alphabetical sorting. Below, you will find a couple of examples when alphabetical order can only be done with formulas.
How to alphabetize in Excel by last nameSince there are a few common ways to write names in English, you may sometimes find yourself in a situation when the entries start with the first name while you need to alphabetize them by the last name:
Excel’s sort options cannot help in this case, so let’s resort to formulas.
With a full name in A2, insert the following formulas in two different cells, and then copy them down the columns until the last cell with data:
In C2, extract the first name:
=LEFT(A2,SEARCH(" ",A2)-1)
In D2, pull the last name:
=RIGHT(A2,LEN(A2)-SEARCH(" ",A2,1))
And then, concatenated the parts in the reverse order separated by comma:
=D2&", "&C2
The detailed explanation of the formulas can be found here, for now let’s just focus on the results:
In case you need to revert to the original First Name Last Name format, there is a little more work for you to do:
Split the names into two parts again by using the below formulas (where E2 is a comma-separated name):
Get the first name:
=RIGHT(E2, LEN(E2) - SEARCH(" ", E2))
Get the last name:
=LEFT(E2, SEARCH(" ", E2) - 2)
And bring the two parts together:
=G2&" "&H2
Perform the formulas to values conversion one more time, and you are good to go!
The process may look a bit complex on paper, but trust me, it will take only a few minutes in your Excel. In fact, it will take even less time than reading this tutorial, let alone alphabetizing the names manually 🙂
How to alphabetize each row individually in ExcelIn one of the previous examples we discussed how to alphabetize rows in Excel by using the Sort dialog box. In that example, we were dealing with a correlated set of data. But what if each row contains independent information? How do you alphabetize each row individually?
In case you have a reasonable number of rows, you can sort them one by one performing these steps. If you have hundreds or thousands of rows, that would be an enormous waste of time. Formulas can do the same thing much faster.
Suppose you have many rows of data that should be re-arranged alphabetically like this:
To begin with, copy the row labels to another worksheet or another location in the same sheet, and then use the following array formula to put each row in alphabetical order (where B2:D2 is the first row in the source table):
=INDEX($B2:$D2, MATCH(COLUMNS($B2:B2), COUNTIF($B2:$D2, "<="&$B2:$D2), 0))
Please remember that the correct way to enter an array formula in Excel is by pressing Ctrl + Shift + Enter.
If you are not very comfortable with Excel array formulas, please following these steps to enter it correctly in your worksheet:
Type the formula in the first cell (G2 in our case), and press
Ctrl + Shift + Enter
. As you do this, Excel will enclose the formula in {curly braces}. Do not try typing the braces manually, that won’t work.
Select the formula cell (G2) and drag the fill handle rightwards to copy the formula to other cells of the first row (up to cell I2 in this example).
Select all the formula cells in the first row (G2:I2) and drag the fill handle downwards to copy the formula to other rows.
Important note! The above formula works with a couple of caveats: your source data should not contain empty cells or duplicate values.
If your dataset has some blanks, wrap the formula in the IFERROR function:
=IFERROR(INDEX($B2:$D2,MATCH(COLUMNS($B2:B2),COUNTIF($B2:$D2,"<="&$B2:$D2),0)), "")
How this formula worksThe above formula is based on the classic INDEX MATCH combination used to perform horizontal lookup in Excel. But since we need kind of “alphabetical lookup”, we have rebuilt it in this way:
COUNTIF($B2:$D2,”<=”&$B2:$D2) compares all the values in the same row with each other and returns an array of their relative ranks. For example, in row 2 it returns {2,3,1}, meaning Caden is 2nd, Oliver is 3rd, and Aria is 1st. This way, we get the lookup array for the MATCH function.
COLUMNS($B2:B2) supplies the lookup value. Due to a clever use of absolute and relative references, the returned number is incremented by 1 as we go right. That is, for G2, the lookup value is 1, for H2 – 2, for I2 – 3.
MATCH searches for the lookup value calculated by COLUMNS() in the lookup array returned by COUNTIF(), and returns its relative position. For example, for G2, the lookup value is 1, which is in the 3rd position in the lookup array, so MATCH returns 3.
Finally, INDEX extracts the real value based on its relative position in the row. For G2, it fetches the 3rd value in the range B2:D2, which is Aria.
How to sort each column alphabetically in ExcelIf you are dealing with independent subsets of data organized vertically in columns, you can easily tweak the above formula to alphabetize each column individually. Just replace COLUMNS() with ROWS(), make a few column coordinates absolute and row coordinates relative and your formula is ready:
=INDEX(A$3:A$5,MATCH(ROWS(A$3:A3),COUNTIF(A$3:A$5,"<="&A$3:A$5),0))
Please remember it’s an array formula, which should be completed with Ctrl + Shift + Enter:
To have a closer look at the formulas discussed in this tutorial, you are welcome to download our Excel Alphabetical Order worksheet. I thank you for reading and hope to see you on our blog next week!
You may also be interested in
How To Use Find And Replace In Excel
Learning how to use Find and Replace in Excel 2010, or Excel 2007, can save you a great deal of time if you have to change a lot of values or formulas on a worksheet. Learn how to use the Find and Replace function in Excel with this guide and never waste time making changes to a worksheet again…
What is Find and Replace
The Find and Replace function in Excel does exactly what it says, it finds a value, text string or formula and replaces it with a different value, text string or formula as specified by you the user.
For example you may have a worksheet that contains raw employee data with one of the fields being the team of each employee. If one, or more, of those team names suddenly get renamed by the business then using Find and Replace in Excel can save you the hassle of manually amending all the cells individually, you can just get Excel to do the hard work and change all occurrences of Team X to Team Y.
How to access the Find and Replace function in Excel
This method works the same for Excel 2010 and Excel 2007, even earlier versions should work similar if you are still working on Excel 2003 for example.
There are 2 ways to access the Find and Replace function in Excel, the first is by means of the Excel ribbon on the top of the screen.
To access the Find and Replace function using the Ribbon:
1) Make sure you are on the Home tab
Basic Changes
If like in the previously mentioned example you just want to change a team name within a dataset, i.e. change “Marketing” to “Marketing and Advertising”, you can simply enter the change on the basic view of the Find and Replace Function like so:
Advanced Options Explained
Formats: In the top right of the Find and Replace function window there is now an option button for “Format”.This can be used if you want to only search for a particular format, or if you want to replace using a particular format.Examples of this might be changing certain text to a different colour or to a different font style, like italic or bold.
Within: The drop down box next to “Within” allows you to change whether Excel looks at the active worksheet (as identified by “Sheet”) or you can also change this to “Workbook” if you want Excel to Find and Replace throughout the whole workbook.
Search: This drop down box allows you to change the way Excel searches from “By Rows” to “By Columns”.It’s data dependent on what is best but usually you can leave this set to “By Rows” as Excel will still search the entire worksheet or workbook.
Look in: This is always set to “Formulas” making it kind of redundant, it just means Excel will look in the formula as well as just text strings or numerical values when it completes the Find and Replace.
Match case: If there are times where you need Excel to be case specific, i.e. only change “MARKETING” and not “Marketing” then check this box.
Match Entire Cell Contents: Again this is another very specific option which tells Excel to only Find and Replace cells where the entire cell matches what it is trying to chúng tôi example if you want to only find “Marketing” and not cases where the cell is “Marketing team” then you would check this box.
Access the Find and Replace function from the “Home” tab or use the shortcut command CTRL+H.
Advanced changes, i.e. searching for certain formats or exact matches can be made by setting additional options in the Find and Replace function.
As always I would recommend completing any changes in a copy of your workbook first so if you make any mistakes you can revert back to the original.
That is really all there is to the Find and Replace function in Excel 2010, or Excel chúng tôi is an amazingly powerful tool which all analysts and Excel users should understand as it can enable you to make multiple changes to an Excel file in no time at chúng tôi can use that extra time to grab yourself a nice cup of coffee!
Keep Excelling,
How To Clear Recent Document Lists From Excel?
How to clear recent document lists from Excel?
The recent opened workbook lists will be stored in the Recent pane when we open an Excel file each time as following screenshot shown. But, sometimes, you need to clear such long boring workbook lists from the Recent pane. This article will show you how to make the recent document lists disappear.
Clear the recent document lists with Options feature Clear the recent document lists with Clear unpinned Workbooks function Clear the recent document lists with VBA code
Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
Clear the recent document lists with Options featureTo remove the recent document lists in Excel, you can go to the Excel Options to do a little setting. Please do as follows:
Note: If you want to restore the recent items, you can type the number back to the Show this number of Recent Documents text box in the Excel Options dialog.
Clear the recent document lists with Clear unpinned Workbooks functionYou can also remove all the recent document lists by applying the Clear unpinned Workbooks feature.
Notes:
1. After removing the recent document lists, they are not restored any more, and this method is only applied to Excel 2010, 2013.
2. This method only remove the unpinned files.
Clear the recent document lists with VBA codeThe following VBA code can help you to remove all the recent document lists immediately as well.
1. Press the ALT + F11 keys together, and it opens the Microsoft Visual Basic for Applications window.
VBA code: remove the recent document lists
Sub Clearrecentfiles() 'Update 20140925 On Error Resume Next Application.RecentFiles.Item(1).Delete Loop End Sub3. Then press F5 key to run this code, and all the recent document lists have been removed at once.
Note: With this code, the recent document lists cannot be restored.
Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails…
More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
Open and create multiple documents in new tabs of the same window, rather than in new windows.
Cập nhật thông tin chi tiết về How To Find Column Index Number From Table In Excel trên website Hoisinhvienqnam.edu.vn. Hy vọng nội dung bài viết sẽ đáp ứng được nhu cầu của bạn, chúng tôi sẽ thường xuyên cập nhật mới nội dung để bạn nhận được thông tin nhanh chóng và chính xác nhất. Chúc bạn một ngày tốt lành!