The column index number in VLOOKUP is the position of the column you want to return, counting from the leftmost column of the table range you selected (the first column is 1, the second is 2, and so on). For example, in =VLOOKUP("Apple", A2:C10, 3, FALSE), the 3 tells Excel to return the value from the third column of range A2:C10 (column C).
What Is the Column Index Number?
VLOOKUP (Vertical Lookup) searches for a value in the first column of a table and returns a value from a different column in the same row. The column index number is the third argument in the function, written as col_index_num. It must be a positive integer (1, 2, 3, etc.) that corresponds to the column’s position within the range you gave, not the column’s letter on the worksheet.
For instance, if your table is B2:D100, then column B is index 1, column C is index 2, and column D is index 3. Even though column D is the fourth column of the sheet, it’s index 3 in this range. This is a common source of confusion: the index is relative to the range, not the sheet.
How to Choose the Right Column Index Number
To pick the correct index, count the columns from left to right starting at the first column of your selected range. The first column is always 1. Then count each column to the right until you reach the one with the data you want to return.
- If your range starts at A, then A=1, B=2, C=3, etc.
- If your range starts at C, then C=1, D=2, E=3, etc.
- If your range starts at a non-adjacent set (rare but possible), the index still counts only the columns inside that range.
Example: Suppose you have a product list in A2:C10 with columns: A=Product Name, B=Price, C=Stock. To return the price, use 2; to return stock, use 3. The formula =VLOOKUP("Widget", A2:C10, 2, FALSE) returns the price of the Widget.
What Happens When the Index Is Wrong?
If you use a column index number that is less than 1, Excel returns a #VALUE! error. If you use a number greater than the number of columns in the range, you get a #REF! error. For example, with range A2:C10 (3 columns), using 4 gives #REF! because there is no fourth column.
If the index points to a column that exists but is empty or contains text when you expect numbers, you’ll just get that value, which might be blank or text—no error. Also, if you accidentally use 0, you’ll get #VALUE! because 0 is not a valid column position.
Using a Dynamic Column Index with MATCH
Hardcoding a number like 2 or 3 is fine when your table layout never changes. But if columns get inserted or removed, your formula may break. To make the index dynamic, combine VLOOKUP with MATCH, which finds the position of a header name.
For example, with headers in A1:C1 (Product, Price, Stock) and data in A2:C10, to return the column labeled “Stock”, use:
=VLOOKUP("Widget", A2:C10, MATCH("Stock", A1:C1, 0), FALSE)
Here, MATCH("Stock", A1:C1, 0) returns 3 because Stock is the third header. If you insert a new column between Price and Stock, the MATCH automatically updates to 4, and the formula still works. This is a best practice for robust spreadsheets.
Column Index in XLOOKUP vs. VLOOKUP
XLOOKUP (available in Excel 2021 and Microsoft 365) does not use a column index number. Instead, you specify the return range directly. For example, =XLOOKUP("Widget", A2:A10, C2:C10) returns the value from column C. This is simpler and less error-prone because you don’t count columns.
If you’re using an older version of Excel (2016 or earlier), VLOOKUP is your option. But if you have XLOOKUP, consider using it to avoid the column index issue entirely. The syntax is: =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found]).
Common Mistakes and How to Avoid Them
Several frequent errors relate to the column index number:
- Counting from the sheet instead of the range: Always count from the first column of the range you typed in the formula.
- Using a column letter: The index must be a number, not a letter. Writing
VLOOKUP("x", A:C, "B", FALSE)is invalid. - Forgetting to update the index when inserting a column: If you add a column inside your table, the index shifts. Use MATCH to avoid this.
- Using 0 or negative numbers: These cause errors; the minimum is 1.
- Copying formulas with relative ranges: If you copy a VLOOKUP down, the range may shift. Use absolute references like
$A$2:$C$10to lock it.
Frequently Asked Questions
Can the column index number be zero?
No. A column index of 0 returns a #VALUE! error. The smallest valid index is 1, which refers to the first column of the range (the lookup column itself).
What if my table has hidden columns? Does the index count them?
Yes, hidden columns still count. The index is based on the actual column positions in the range, not what’s visible. If you hide column C, the index for column D is still 4, not 3.
How do I return a value from a column to the left of the lookup column?
VLOOKUP cannot return values to the left because the lookup column must be the first column in the range. To return a left-side value, use INDEX/MATCH or XLOOKUP. For example, =INDEX(A:A, MATCH("Widget", B:B, 0)).
Why does my VLOOKUP return #REF! when I change the column index?
#REF! means the index is larger than the number of columns in the range. Check the range’s width. For instance, if your range is A2:C10 (3 columns), any index above 3 causes #REF!.
Does the column index need to be an integer?
Yes, it must be a whole number. If you enter a decimal like 2.5, Excel truncates it to 2 (it does not round). For example, 2.9 becomes 2.
Can I use a cell reference for the column index?
Yes, you can put a number in a cell (say, E1) and reference it: =VLOOKUP("Widget", A2:C10, E1, FALSE). This makes it easy to change the returned column without editing the formula.
Related
- Python dict update method: how it works
- Amex Send & Split: How It Works, Limits, Fees
- Case When Count Distinct SQL: Syntax & Examples
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Excel Custom Number Format: Add Text at the Far LeftYes. In Excel for Microsoft 365 on Windows, use a custom number format with an asterisk followed by…
- JavaScript Functions Within Functions: How They WorkYes. JavaScript lets you define a function inside another function; the inner function can use variables from the…
- PMT Function in SQL: Calculate Loan Payments by PeriodSQL does not have a universally available built-in PMT function. To calculate a fixed loan payment, use the…
- Excel Formula for Choosing a Random Name from a ListWith names in A2:A20, enter =INDEX($A$2:$A$20,RANDBETWEEN(1,ROWS($A$2:$A$20))) in an empty cell to choose one at random. Excel returns a…
- Excel Conditional Formatting Formula for Due Dates ExplainedIn Excel for Microsoft 365 on Windows, select the cells to format, choose Home > Conditional Formatting >…
- Excel IF Statement for Dates: Compare Dates and Set RulesWith due dates in A2:A20, enter a formula in B2 to label each date as overdue or not:…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.