Excel allows us to get the column number from the Excel Table using MATCH function. The MATCH function logic is the same as for the regular cell ranges. The only difference is coming from the lookup array referencing in the Excel Table. This step by step tutorial will assist all levels of Excel users to get Excel Table column index.
Figure 1. How to get column index in Excel table
Syntax of the MATCH Formula
=MATCH(lookup_value, lookup_array, [match_type])
The parameters of the MATCH function are:
- lookup_value – a value which we want to find in the lookup_array
- lookup_array – the array where we want to find a value
- [match_type] – a type of match. We put 0 which is an exact match.
Setting up Our Data to Get Excel Table Column Number
Our first table consists of 4 columns: “Store” (column B), “Payment date” (column C), “Amount” (column D) and “Week Number” (column E). This table is defined as an Excel Table with the name “Table 1”.The second one has 2 columns: “Column name” (Column G) and “Column index” (Column H). The idea is to get column number from the first table based on the column name in Column G.
Figure 2. Table structure for Excel Table column index
MATCH Function to get Column Index from Table 1
We want to get column index from the first table based on the “Column name” in the Column G.
The formula looks like:
The lookup_value in the MATCH function is the cell G3, the first table column name. The lookup_array is the Table 1 header, Table1[#Headers], while the match_type is 2.
To apply the MATCH function to get the Excel table column index we need to follow these steps:
- Select cell H3 and click on it
- Insert the formula:
- Press enter
- Drag the formula down to the other cells in the column by clicking and dragging the little “+” icon at the bottom-right of the cell.
Figure 3. Get column index in Excel Table with MATCH function
MATCH function returns the relative position of the cell G3 (Column name) in the Table 1 header range. Formula result is number 1 since “Store” is the first column in Table 1.
Reference of the lookup_array for the Excel Table is different from the regular cell ranges. This array refers to the header of Table 1. We can add columns and change Table 1 and the lookup_array will automatically recognize range changes.
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.