Excel

Replace VLOOKUP with XLOOKUP

VLOOKUP fails in two ways that show up on a real spreadsheet. Leave the fourth argument blank and Excel treats it as an approximate match, so the wrong row can come back with no warning. The third argument is a column count, so inserting a column in the middle changes the answer.

XLOOKUP takes the lookup column and the return column as two separate ranges. Insert a column and both ranges move with it.

Build it

  1. Put the data in an Excel Table first. Select the range and press Ctrl+T (Cmd+T on a Mac). Name the table Policies on the Table Design tab. Table names cannot contain spaces.

  2. In the cell that should show the insured, enter:

    =XLOOKUP(E2, Policies[PolicyNumber], Policies[Insured], "Not on the bordereau")
  3. E2 is the policy number you are matching. Change the column names to the ones on your table.

  4. Fill the formula down. You are not counting columns, so the formula does not care what order the columns are in.

Why the fourth argument matters

"Not on the bordereau" is the optional if_not_found argument. A policy that is not in the table shows that sentence instead of #N/A. That is the version you can email to someone who does not read formulas.

When you need every matching row

XLOOKUP returns the first match. If one policy number can sit on more than one row and you need all of them, use FILTER instead. There is a separate tip for that.

Exact match is the default. You do not pass FALSE or 0 the way you should with VLOOKUP. That is the whole reason it is the safer function for an account number.

Try this today

On a copy of a sheet you already use, replace one VLOOKUP that returns a name with XLOOKUP. Then insert a column inside the old lookup range and confirm the result stays put.

XLOOKUP is in Microsoft 365 and Excel 2021. It is not in Excel 2016 or Excel 2019.

More Excel tips