Smart Systems for Home

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

Google Sheets Lookup Formula: Step-by-Step Guide

· 7 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

A lookup formula in Google Sheets pulls a value from one part of a sheet (or another sheet entirely) based on a matching key. The quickest working setup is VLOOKUP: put your search key in a cell, then write =VLOOKUP(A2, Products!A:C, 3, FALSE), where A2 is what you are searching for, Products!A:C is the table to search, 3 counts the column to return, and FALSE demands an exact match. If your key is not in the leftmost column of the table, use INDEX with MATCH instead. This guide covers both, plus XLOOKUP where it is available, and the usual reasons lookups return #N/A or the wrong row.

What You'll Need

  • A Google account with access to Google Sheets (free with any Google account).
  • A spreadsheet with at least two columns of related data — one column of unique keys (IDs, SKUs, names, dates) and one or more columns of values to return.
  • Your data organised so the lookup key is reasonably clean: no stray leading spaces, consistent capitalisation is not required but consistent formatting is.
  • A basic idea of which column holds the key and which holds the answer. Write it down if the sheet is wide.

Step-by-Step

  1. Set up a clean source table. Put the lookup data in its own range, ideally on a separate tab (for example a tab named Products). Make the leftmost column of that range the unique key. Do not merge cells inside the range — merged cells break lookups in confusing ways. Leave no blank rows in the middle of the table.
  2. Decide where the answer should appear. Click the cell where you want the looked-up value, on a different sheet or a different part of the same sheet. Keeping the working formula next to your input key makes errors easier to spot.
  3. Type the basic VLOOKUP. Start with =VLOOKUP( and supply four arguments separated by commas: the search key, the range, the column number, and the match type. A complete example: =VLOOKUP(A2, Products!$A$2:$D$500, 3, FALSE). Press Enter and check that the returned value is genuinely the one you expected for that key.
  4. Always use FALSE for the last argument. FALSE (or 0) means exact match. Leaving it out or using TRUE performs an approximate match that assumes the first column is sorted ascending, and it will happily return a neighbouring row's data without warning. For lookups of IDs, names, emails or SKUs, exact match is what you want essentially every time.
  5. Lock the range with dollar signs. Write the table range as $A$2:$D$500 rather than A2:D500. Without the $, dragging the formula down shifts the range and later rows start looking in the wrong place. Press F4 while the range is highlighted in the formula bar to toggle the dollar signs on desktop.
  6. Copy the formula down the column. Drag the fill handle (the small square at the bottom-right of the selection) or copy the cell and paste it into the rows below. Each row should return a different, sensible value.
  7. Switch to INDEX and MATCH when the key is not in the first column. VLOOKUP can only search left to right, so if your key sits to the right of the value you want, use =INDEX(Products!$C$2:$C$500, MATCH(A2, Products!$A$2:$A$500, 0)). Read it as: find the row number where the key appears with MATCH, then return the value from that row in the INDEX column. The 0 is the exact-match flag and is not optional.
  8. Try XLOOKUP if your account offers it. Google Sheets now supports XLOOKUP in many accounts, and it is simpler: =XLOOKUP(A2, Products!$A$2:$A$500, Products!$C$2:$C$500, "Not found"). It needs only the key column and the return column — no column counting — and the fourth argument gives a friendly fallback instead of an error. If the function is not offered in your account, the formula will not calculate; fall back to VLOOKUP or INDEX/MATCH.
  9. Wrap the result in IFERROR for tidiness. Change the formula to =IFERROR(VLOOKUP(...), "") to show a blank, or IFERROR(VLOOKUP(...), "Check key") to show a message, when no match exists. This keeps a report readable when some keys are missing from the source table.
  10. Test the edge cases deliberately. Enter a key that does not exist and confirm you get your fallback. Enter a key with a trailing space and see whether it matches. Test a key with different capitalisation. These three tests catch most of the real-world failures before anyone else sees the sheet.
  11. Convert to values when you are finished. If the sheet will be shared or the source range might move, select the formula cells, copy them, and use Edit > Paste special > Values only to replace formulas with their results. Be aware this removes the live link to the source data — do it on a copy if you still need the connection.

Common Mistakes

Forgetting the match type. The single most frequent cause of wrong answers. Omit the last argument and Sheets assumes approximate matching, which gives a plausible but incorrect result.

Counting columns from the wrong starting point. The column number in VLOOKUP counts from the first column of the range you supplied, not from column A of the sheet. If your range starts at column B, then column 1 is B.

Inconsistent data types. A number stored as text (often imported from a CSV) will never match a real number. Look for the green triangle in the corner of the cell, and use the conversion option in the tooltip to fix it.

Hidden whitespace. Keys copied from emails or websites often carry a trailing space. Wrap the key in TRIM(), as in =VLOOKUP(TRIM(A2), ...), or clean the source column with Data > Trim whitespace.

Partial ranges. Selecting A2:D100 when data runs to row 500 silently drops later rows. Select whole columns (A:D) if the sheet is stable, or size the range generously.

Duplicated keys. VLOOKUP and MATCH return the first match only. If a key appears twice, you will get whichever row comes first, with no warning. Check for duplicates with =COUNTIF(A:A, A2)>1.

Tips

Name your source range (Data > Named ranges) and use the name in the formula, such as =VLOOKUP(A2, ProductList, 3, FALSE). The formula becomes readable and survives inserted rows.

Use ARRAYFORMULA with VLOOKUP to fill an entire column from a single cell: =ARRAYFORMULA(IFERROR(VLOOKUP(A2:A, Products!$A$2:$D$500, 3, FALSE))). One edit updates the whole column.

For two-condition lookups, add a helper column in the source table that concatenates the two keys, and do the same to your search key. Wildcard matching with * in a VLOOKUP key also works for partial text.

Keep a small test block at the top of your working sheet: one known key, one missing key, one messy key. Re-run it after every structural change.

Troubleshooting

If that did not work

If you see #N/A, the key was not found. Compare the exact key text against the source cell character by character, and check for spaces, leading apostrophes, text-versus-number storage, or a range that starts below the row you need.

If you get #REF!, the column number exceeds the width of the range you selected — for example, column 5 on a four-column range.

If the answer is wrong but not an error, suspect approximate matching first (missing FALSE), then a shifted range caused by missing dollar signs, then duplicate keys.

If #NAME? appears, the function name is misspelled or, in the case of XLOOKUP, unsupported in your account. Check the spelling and fall back to INDEX/MATCH if needed.

If dragging the formula produces the same value in every row, the key reference lost its relative row number — you likely wrote $A$2 where you needed A2.

If formulas are mysteriously slow on a very large sheet, replace whole-column ranges like A:A with bounded ranges such as A2:A5000.

Frequently Asked Questions

What is the difference between VLOOKUP and INDEX/MATCH?

VLOOKUP searches only the first column of the range and returns a column to its right. INDEX/MATCH can search any column and return a value from any other column, including one to the left of the key, and it does not break when the source table is reordered.

How do I look up a value from another sheet?

Prefix the range with the tab name and an exclamation mark, for example Products!A2:D500. If the tab name contains a space, wrap it in single quotes: 'Product List'!A2:D500.

Why does my lookup return the wrong row?

Almost always because the fourth VLOOKUP argument is missing or set to TRUE. Add FALSE to force an exact match. If it still misbehaves, check for duplicate keys and unlocked ranges.

Can a lookup return several columns at once?

Yes. Give a column-number array such as {2,3,4} as the third argument, or use XLOOKUP with a multi-column return range, and the results spill into adjacent cells.

Does VLOOKUP work with dates and times?

Yes, provided both the key and the source are real date values rather than text. A date typed as text will not match. Check by formatting the cell as a number — a real date shows a serial number.

Why does the formula break after I add rows to the source table?

Because the range was fixed at an earlier last row. Extend the range or switch to a named range, which expands with the data. For partially filled ranges, leaving spare rows inside the range is a practical safeguard.