Smart Systems for Home

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

VLOOKUP Within Range: Step-by-Step Guide

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

To use VLOOKUP within a range, you point the function at a specific block of cells (the table_array) and set the fourth argument to TRUE for an approximate match or FALSE for an exact match. The range must be arranged so the lookup value sits in the first column of that range, and the formula will only search inside those cells. This guide walks through the exact steps, the common pitfalls, and how to fix errors when the result is not what you expect.

What You'll Need

  • Excel, Google Sheets, or another spreadsheet app that supports VLOOKUP (the steps below use Excel and Google Sheets; menu labels can differ slightly by version, device, or region).
  • A dataset with the lookup value in the leftmost column of the range you plan to search.
  • A cell where you want the result to appear.

Step-by-Step

  1. Identify your lookup value and range. Decide which value you are searching for (for example, a product ID in cell A2) and which block of cells contains the answer. The lookup value must be in the first column of that block. For example, if your table has IDs in column A and prices in column B, the range A2:B100 works because the ID is in the first column of that range.
  2. Click the cell where the result should appear. This is where you will type the formula.
  3. Type the VLOOKUP formula. The syntax is =VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]). For example: =VLOOKUP(A2, A2:B100, 2, FALSE). This searches for the value in A2 within the range A2:B100, returns the value from the second column of that range, and requires an exact match because the last argument is FALSE.
  4. Set the fourth argument correctly. Use FALSE (or 0) for an exact match, which is what most people want. Use TRUE (or 1) only when your data is sorted ascending and you need an approximate match, such as finding a tax rate for a given income. If you omit the fourth argument, Excel defaults to TRUE, which can give wrong results.
  5. Press Enter. The result should appear in the cell. If you see an error, check the troubleshooting section below.
  6. Copy the formula down. Drag the fill handle or copy and paste the formula to other rows. If you plan to copy it, consider using absolute references for the range (for example, $A$2:$B$100) so the range does not shift. You can type the dollar signs manually or press F4 after selecting the range in the formula bar (on Windows; on Mac, use Command+T or the function key depending on your keyboard settings).
  7. Verify a few results. Pick a few rows and manually check that the returned value matches the source data. This catches range mistakes early.

Common Mistakes

  • Lookup value not in the first column. VLOOKUP only searches the leftmost column of the range. If your lookup value is in column B but your range starts at column A, it will not find it. Either rearrange your data or use INDEX and MATCH instead.
  • Forgetting the fourth argument. Omitting it makes VLOOKUP use approximate match (TRUE), which can return the wrong row if the data is not sorted. Always type FALSE for exact matches.
  • Range not locked. When you copy the formula down, a relative range like A2:B100 will shift to A3:B101, A4:B102, and so on. Use absolute references ($A$2:$B$100) to keep the range fixed.
  • Column index out of bounds. The col_index_num must be between 1 and the number of columns in the range. If your range is A2:B100 (two columns), a col_index_num of 3 will return #REF!.
  • Data type mismatch. If the lookup value is text but the range contains numbers (or vice versa), VLOOKUP may return #N/A. Check that both are formatted the same way.
  • Extra spaces. Trailing spaces in either the lookup value or the range can cause #N/A. Use TRIM to clean values if needed.

Tips

  • Use named ranges to make formulas easier to read. Select your range, then type a name in the Name Box (Excel) or use Data > Named ranges (Google Sheets). Then you can write =VLOOKUP(A2, MyRange, 2, FALSE).
  • For approximate matches, sort the first column of the range in ascending order. Otherwise, TRUE may return unpredictable results.
  • If you need to look up values to the left, use INDEX and MATCH instead of VLOOKUP, since VLOOKUP cannot look left.
  • Wrap VLOOKUP in IFERROR to display a friendly message instead of #N/A: =IFERROR(VLOOKUP(A2, A2:B100, 2, FALSE), "Not found").
  • In Google Sheets, the syntax is the same, but you can also use the range A2:B100 directly. The fourth argument works the same way.

Troubleshooting

If VLOOKUP returns #N/A, the lookup value was not found in the first column of the range. Check for typos, extra spaces, or data type mismatches. You can use =TRIM(A2) to remove spaces, or convert numbers stored as text to numbers.

If you get #REF!, the col_index_num is larger than the number of columns in the range. Count the columns in your range and adjust the number.

If you get #VALUE!, one of the arguments is the wrong type. For example, col_index_num might be text instead of a number.

If the result is wrong but no error appears, check the fourth argument. If it is TRUE or omitted, VLOOKUP may return an approximate match. Change it to FALSE for exact matches. Also verify that the range is correct and that the lookup value is in the first column.

If the formula works in one cell but not when copied down, check for absolute references. The range should be locked with dollar signs if you want it to stay the same.

Frequently Asked Questions

Can VLOOKUP search a range that is not sorted?

Yes, if you use FALSE for exact match. For approximate match (TRUE), the first column must be sorted ascending.

What does the fourth argument in VLOOKUP do?

It controls match type: FALSE or 0 for exact match, TRUE or 1 for approximate match. If omitted, it defaults to TRUE.

Why does VLOOKUP return #N/A when the value exists?

Common causes are extra spaces, data type mismatch (text vs. number), or the value not being in the first column of the range.

Can I use VLOOKUP to look up values to the left?

No, VLOOKUP only searches the leftmost column of the range and returns values to the right. Use INDEX and MATCH for left lookups.

How do I make the range absolute in VLOOKUP?

Add dollar signs before the column and row references, like $A$2:$B$100. In Excel, you can press F4 after selecting the range in the formula bar.

Does VLOOKUP work in Google Sheets?

Yes, the syntax and behavior are the same as in Excel.