Excel Supreme

Excel track · Exercise 42 of 86 Paid

Lookup functions summary

Pick the lookup that can return a column to the left of its key.

Intermediate

Products left of their SKUs

Read-only data · answer in B7

In B7, return the product name for the SKU in B6, even though the name column sits left of the key.

ABC
1ProductSKUOn hand
2BracketBX-210240
3ClampCX-33096
4DowelDX-41060
5ExtrusionEX-50018
6Which SKU?DX-410
7Product

Download this grid (.xlsx) Two tabs: the grid you see, and the answer.

B7

What it does

Four functions do this job: VLOOKUP, HLOOKUP, INDEX with MATCH, and XLOOKUP. VLOOKUP reads right from the key column and HLOOKUP reads down from the key row. INDEX with MATCH reaches either way, at the cost of two functions.

This sheet puts the product name left of the SKU, which is the case that separates them. VLOOKUP cannot return a column left of its first column. XLOOKUP names B2:B5 to search and A2:A5 to return, and the leftward move costs nothing.

Choose by where the answer sits. Right of the key, VLOOKUP is one function and one number. Left of it, XLOOKUP names the column without counting.

Syntax

=XLOOKUP(value, search column, return column)

Worked example

On Products left of their SKUs, =XLOOKUP(B6,B2:B5,A2:A5) returns Dowel.

=XLOOKUP(B6,B2:B5,A2:A5)

Common errors

Error codes for Choosing between the lookup functions
ErrorWhat it means and how to fix it
#N/ANothing in the searched column matched, so the lookup has no row to return from.
#REF!A VLOOKUP column number counted past the returned range, so it points at a column that is not there.

At work

A stock file exported by a till, where the code sits to the right of a description nobody wants to retype.