Skip to the page

Excel and BI · core

Excel lookups and cleaning messy imports

XLOOKUP, INDEX-MATCH and VLOOKUP differ in match type, direction and safety. Most lookup errors and wrong dates come from data types, hidden characters and regional settings, not from the formula.

The notes

What you must know

  • VLOOKUP looks only to the right of the key column, uses a column number that breaks when columns are inserted, and defaults to approximate match. Without FALSE (or 0) it can return a wrong value with no error.
  • INDEX-MATCH works in any direction, survives inserted columns and works in every version. Use MATCH(..., 0) for an exact match.
  • XLOOKUP matches exactly by default, looks left or right, has an if_not_found argument, can search from last to first, and can return several columns. It is in Microsoft 365, Excel 2021 and 2024, not in 2019 or 2016, where the file shows #NAME?.
  • Two conditions: XLOOKUP(1, (A2:A100=id)*(B2:B100=month), C2:C100), a helper key column, or FILTER.
  • #N/A for codes that are there: numbers stored as text in one file, trailing or non-breaking spaces, dropped leading zeros, hidden characters. Check with ISNUMBER, LEN and CODE (160 is a non-breaking space).
  • Fixes: TRIM with SUBSTITUTE(..., CHAR(160), ""), and VALUE or TEXT so both sides have the same type. Keep product codes as text on both sides. Set types in Power Query so every refresh does it.
  • Do not hide #N/A with IFERROR. Codes that are really missing are gaps for the master-data owner, and IFERROR to blank reports those sales as zero.
  • Text dates follow the computer's regional settings. On a month-first setting 03/04 becomes 4 March, and 25/04 stays as text. The silent swaps are the dangerous ones. Import with Data > From Text/CSV and set the type using the English (India) locale, or use Text to Columns with DMY.
  • Changing the cell format does not change the stored value. Check the result with ISNUMBER and the vendor's total, and ask vendors for ISO dates (2026-04-03).

The red pen

Common traps: mistake → fix

  • Mistake: VLOOKUP is fine without the last argument

    Fix: it defaults to approximate match and can return a wrong value silently.

  • Mistake: IFERROR around every lookup is safe

    Fix: it hides real mismatches and turns them into zeros.

  • Mistake: Changing the date format fixes wrong dates

    Fix: the format changes the display, not the stored value.

Easy to hard

Questions interviewers ask, easy to hard

  1. VLOOKUP, INDEX-MATCH or XLOOKUP: which differences matter?
  2. VLOOKUP gives #N/A for codes that you can see in the master. What do you check?
  3. A CSV opens with dates in the wrong month. How do you clean it safely?
  4. Why does a file with XLOOKUP show #NAME? for some colleagues?

Practise

Practise with these questions

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview