Smart Systems for Home

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

How to Match Cells in Excel: VLOOKUP, MATCH & XLOOKUP

· 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

Matching cells in Excel means checking whether a value in one column also appears in another, or pulling related data from a second list. The quickest reliable method is the XLOOKUP function: =XLOOKUP(A2, D:D, E:E, "No match") checks whether the value in A2 exists in column D and returns the matching value from column E. Older Excel versions without XLOOKUP can use VLOOKUP or MATCH instead, and all versions can do a simple TRUE/FALSE match check with COUNTIF. This guide covers each approach, assuming you have Excel (desktop or Microsoft 365 in the browser) and two lists of data in the same workbook.

What You'll Need

  • Excel on desktop, or Excel for the web via a Microsoft account
  • Your data arranged in columns, with the values you want to match in a single column each (for example, product IDs in column A and product IDs with prices in columns D and E)
  • Five minutes — no add-ins, macros or external tools are required

Step-by-Step

Method 1: XLOOKUP (Excel 2021, Microsoft 365, Excel for the web)

  1. Click the first empty cell next to your first value — for example, B2 if your list starts in A2.
  2. Type =XLOOKUP(A2, D:D, E:E, "No match") and press Enter. A2 is the value to find, D:D is the column to search, and E:E is the column to return the result from.
  3. Check the result. If the value in A2 exists in column D, you'll see the corresponding value from column E; if not, you'll see "No match".
  4. Drag the fill handle (the small square at the bottom-right corner of the cell) down to copy the formula to the rest of your list.
  5. If you only want to know whether a match exists at all, use =XLOOKUP(A2, D:D, "Found", "Not found") instead.

Method 2: VLOOKUP (works in every Excel version)

  1. Click the empty cell next to your first value, such as B2.
  2. Type =VLOOKUP(A2, D:E, 2, FALSE) and press Enter. This searches the first column of D:E for A2 and returns the value from the second column. The FALSE forces an exact match.
  3. Wrap it to handle misses: =IFERROR(VLOOKUP(A2, D:E, 2, FALSE), "No match") so missing values show text instead of a #N/A error.
  4. Drag the fill handle down to apply the formula to the whole column.

Method 3: MATCH and INDEX (when the return column is to the left of the search column)

  1. Click the target cell, such as B2.
  2. Type =INDEX(E:E, MATCH(A2, D:D, 0)) and press Enter. MATCH finds the row number of A2 in column D (the 0 means exact match), and INDEX returns the value from that row in column E.
  3. Add IFERROR around it to catch non-matches: =IFERROR(INDEX(E:E, MATCH(A2, D:D, 0)), "No match").
  4. Fill down.

Method 4: Simple TRUE/FALSE or highlight check with COUNTIF

  1. In B2, type =COUNTIF(D:D, A2)>0 and press Enter. TRUE means the value exists in column D; FALSE means it does not.
  2. To highlight duplicates visually instead, select column A, go to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values, and click OK. Values that also appear in the selection are highlighted. To compare against another column, select both columns first.

Common Mistakes

  • Leaving out the FALSE (or 0) argument in VLOOKUP or MATCH — without it, Excel uses an approximate match, which silently returns wrong results on unsorted data.
  • Trailing spaces or inconsistent capitalisation: "apple " will not match "apple". Use TRIM or check for hidden characters if values that look identical don't match.
  • Numbers stored as text (often shown with a small green triangle in the cell). Text "123" will not match number 123 — convert with Value or re-enter the numbers.
  • Forgetting to lock ranges with dollar signs (for example $D$2:$E$500) when copying formulas across — relative references shift and search the wrong area.
  • Searching a column that isn't the first column of the VLOOKUP range — VLOOKUP only searches the leftmost column of the range.

Tips

  • Prefer XLOOKUP when available: it defaults to an exact match, can return columns to the left, and has a built-in not-found argument.
  • Convert your lookup data to a Table (select it, then Insert > Table) so ranges expand automatically as you add rows.
  • Wrap any lookup in IFERROR to keep your sheet tidy when values are missing.
  • Use =MATCH(A2, D:D, 0) on its own when you only need the position of the match, not a value.

Troubleshooting

  • #N/A error: the value genuinely isn't found — usually due to extra spaces, a number stored as text, or a typo. Try =TRIM(A2)=TRIM(D2) style comparisons or wrap the lookup value in TRIM.
  • #NAME? error: XLOOKUP isn't available in your Excel version — switch to VLOOKUP or INDEX/MATCH.
  • #REF! error: your formula points to a deleted column or the column index number exceeds the range width — fix the range reference.
  • Wrong (not missing) results: you likely omitted the exact-match argument; add FALSE or 0 and re-check.
  • Conditional formatting highlights nothing: confirm the correct columns are selected and that the values truly match — sort both columns to eyeball differences.

Frequently Asked Questions

How do I match two columns and return TRUE or FALSE?

Use =COUNTIF(D:D, A2)>0 for a list search, or =A2=D2 to compare the same row in two columns directly.

What's the difference between XLOOKUP and VLOOKUP?

XLOOKUP defaults to exact matching, searches in any direction, and has a built-in not-found option. VLOOKUP only searches the leftmost column of its range and defaults to approximate matching, so it needs the FALSE argument.

Can I match cells in Excel without formulas?

Yes — select the columns and use Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values to visually highlight matching cells.

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

Almost always a data mismatch: extra spaces, different capitalisation in some cases, or numbers stored as text. Use TRIM on the lookup value and check for the green error triangle on the cells.

How do I match cells across two different workbooks?

Open both workbooks and reference the other file in your formula, for example =VLOOKUP(A2, '[Prices.xlsx]Sheet1'!A:B, 2, FALSE). Both files must be open while you build the formula.

Is MATCH case-sensitive?

No — MATCH, VLOOKUP, XLOOKUP and COUNTIF are all case-insensitive. "ABC" and "abc" count as the same value.