Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

INDEX vs VLOOKUP: Which to Use and How

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Use INDEX/MATCH instead of VLOOKUP when you need to look up a value to the left of the key column, when the key column may move, or when you want a formula that survives inserting or deleting columns. Use VLOOKUP when your data is small, the key is in the first column, and you want the simplest possible formula. That is the short answer. The rest of this guide walks through how each function works, how to build both, and where each one breaks.

What You'll Need

  • A spreadsheet application that supports both functions: Microsoft Excel (desktop or web), Google Sheets, or LibreOffice Calc. All three support INDEX, MATCH, and VLOOKUP with the same argument order.
  • A table of data with a unique key column (an ID, a SKU, an email address) and at least one column of values you want to return.
  • Basic familiarity with cell references and the difference between relative and absolute references (the dollar signs).

Menu labels and function names can differ slightly by version, device, and region, but the formulas below work the same in Excel, Google Sheets, and LibreOffice Calc.

Step-by-Step

  1. Set up a clean lookup table. Put your key column and your return column in a contiguous range, for example A2:C100, with headers in row 1. Make sure the key column contains no duplicates and no leading or trailing spaces; a trailing space is the single most common reason a lookup returns #N/A.
  2. Write a basic VLOOKUP first. In an empty cell, type =VLOOKUP(lookup_value, table_array, col_index_num, FALSE). For example, =VLOOKUP(F2, A2:C100, 3, FALSE) looks for the value in F2 in column A and returns the value from column C (the third column of the range). Always use FALSE (or 0) for the last argument unless your data is genuinely sorted and you want an approximate match.
  3. Notice VLOOKUP's constraint. The lookup value must be in the first column of the range you pass. If your key is in column B and you want to return column A, VLOOKUP cannot do it without rearranging the sheet. That is the main reason people switch to INDEX/MATCH.
  4. Write the MATCH half. MATCH finds the row number of your key. In a cell, type =MATCH(F2, A2:A100, 0). The 0 means exact match. The result is a number, for example 17, meaning the value is the 17th item in that range.
  5. Write the INDEX half. INDEX returns the value at a given row and column within a range. Type =INDEX(C2:C100, 17) and you get the 17th value in column C. On its own that is not useful, but combined with MATCH it becomes a full lookup.
  6. Combine them. Type =INDEX(C2:C100, MATCH(F2, A2:A100, 0)). This reads as: find the position of F2 in column A, then return the value at that position in column C. The two ranges must be the same height (both 99 rows in this example) or the result will be wrong.
  7. Test with a value you know. Pick a key you can verify by eye, enter it in F2, and check the result against the source table. Then test a key that does not exist; both formulas should return #N/A, which is correct behaviour, not a bug.
  8. Wrap for clean output. If you want a blank instead of an error, wrap the formula: =IFERROR(INDEX(C2:C100, MATCH(F2, A2:A100, 0)), ""). The same wrapper works around VLOOKUP.
  9. Lock the ranges before filling down. Select the ranges in the formula and press F4 (Windows) or Cmd+T (Mac) to add dollar signs, so the formula becomes =INDEX($C$2:$C$100, MATCH(F2, $A$2:$A$100, 0)). Without this, dragging the formula down shifts the ranges and breaks the lookup.
  10. Decide which to keep. If the key is in the first column and the sheet is stable, VLOOKUP is fine and easier to read. If the key is anywhere else, if columns get inserted regularly, or if you are returning several columns from the same row, use INDEX/MATCH. For returning many columns, INDEX/MATCH lets you fix the MATCH once and change only the INDEX column reference.

Common Mistakes

  • Leaving the fourth VLOOKUP argument blank or TRUE. That switches to approximate match, which returns wrong values silently on unsorted data. Use FALSE or 0.
  • Mismatched range sizes in INDEX/MATCH. If the INDEX range is 99 rows and the MATCH range is 100, results shift by one row. Keep them identical.
  • Hard-coding the column number in VLOOKUP. Inserting a column to the left of the return column changes the count and returns the wrong field. INDEX/MATCH does not have this problem because it references the column directly.
  • Text stored as numbers. A key that looks like 1001 but is stored as text will not match a numeric 1001. Check with ISTEXT or by aligning the column; numbers align right, text aligns left by default.
  • Hidden spaces. Values copied from other systems often carry a trailing space. TRIM the key column or clean the source data.
  • Forgetting absolute references. The formula works in the first row and fails everywhere below it after filling down.

Tips

  • Name your ranges (Formulas > Define Name in Excel, Data > Named ranges in Google Sheets) so formulas read as =INDEX(Price, MATCH(F2, SKU, 0)) instead of a wall of cell references.
  • Use XLOOKUP if your version supports it; it replaces both functions and handles left lookups natively. INDEX/MATCH is still the safe choice when the file must open in older versions or in LibreOffice.
  • For a two-criteria lookup, combine MATCH with an array or use a helper column that concatenates the two keys. Helper columns are easier to audit than array formulas.
  • Keep the lookup table on its own sheet and reference it with the sheet name, for example Data!$A$2:$C$100. This prevents accidental sorting of the lookup range.
  • When returning several columns, put the MATCH in its own helper cell once and reference it, rather than repeating it in every formula.

Troubleshooting

If you get #N/A, check three things in order: does the key exist in the source (use Ctrl+F), is it stored as the same data type (text vs number), and are there hidden spaces. Cleaning the source usually fixes it.

If you get #REF!, the column index in VLOOKUP is larger than the number of columns in the range, or a referenced sheet was deleted. Recount the columns.

If the formula returns the wrong row's value, your two ranges in INDEX/MATCH are different heights, or the VLOOKUP range does not start at the key column. Rebuild the formula from scratch rather than editing it.

If it works at the top and fails below, the references are relative. Add the dollar signs and fill down again.

If the result is a date serial number instead of a date, format the output cell as a date. The lookup is correct; the display is not.

If nothing works after edits, paste the formula into a text editor, check the commas and parentheses, and paste it back. Regional settings sometimes use semicolons instead of commas as separators.

Frequently Asked Questions

Can INDEX/MATCH look up to the left?

Yes. That is its main advantage over VLOOKUP. The key column and the return column can be in any order as long as both ranges are the same height.

Is INDEX/MATCH faster than VLOOKUP?

On very large sheets it can be, because MATCH searches only the key column rather than the whole table array. On typical home or small-business sheets the difference is not noticeable.

Does Google Sheets support both?

Yes, with the same syntax and argument order as Excel. Google Sheets also supports XLOOKUP in current versions.

Why does VLOOKUP return the wrong value for a number I can see in the table?

Almost always a text-versus-number mismatch or a trailing space. Convert the key column to a consistent type and trim spaces.

Can I use INDEX/MATCH across two sheets?

Yes. Prefix each range with the sheet name, for example Sheet2!$A$2:$A$100, and keep both ranges the same height.

Which should I learn first?

Learn VLOOKUP first because it is simpler to read, then learn INDEX/MATCH because it covers the cases VLOOKUP cannot.