Look up bands with VLOOKUP

Lookups · About 5 minutes

Look up bands with VLOOKUP

Some tables list bands, not exact values. A grade table says "from 60 marks, grade B". Nobody lists every mark from 60 to 74.

With TRUE as the last part, VLOOKUP finds the largest value that is not more than the one you're looking for. For 68 marks it stops at 60 and brings back B. Leaving the last part out does the same thing.

=VLOOKUP(B9,A2:B7,2,TRUE) reads as "find the band B9 falls into in A2:B7, and bring back column 2". The first column must be sorted from smallest to largest, or the answer is unreliable.

Part of Plus

Free during our founding launch: sign in to unlock this lesson's exercises, the timed practice sets and the rest of Plus. The free lessons stay free, with no account needed.

What VLOOKUP approximate match does

An approximate match finds which band a number falls into. A band table lists only where each band starts, like "from 5 years, 18 days of leave". VLOOKUP walks down the first column and stops at the largest start that is not more than your number.

This is how you look up commission tiers, shipping charges by weight, tax slabs or discount levels without listing every possible value. Change the number and the answer moves to the right band by itself.

How to write VLOOKUP approximate match

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

lookup_value
The number to place in a band, like a weight or a sales total.
table_array
The band table. Its first column holds where each band starts, sorted from smallest to largest.
col_index_num
Which column of the table to bring back: 1 is the first column, 2 the next, and so on.
range_lookup
TRUE for an approximate match, FALSE for exact only. It is optional, and leaving it out means TRUE.

VLOOKUP approximate match worked example

A company gives more leave the longer people stay. In D2, find the leave days for someone with the years of service in C2.

A company gives more leave the longer people stay. In D2, find the leave days for someone with the years of service in C2.
ABCD
1YearsLeaveStaff yrsLeave
2012718
3215
4518
51021
61524
D2=VLOOKUP(C2,A2:B6,2,TRUE)Find the band that 7 years falls into in A2:B6 and bring back column 2. The largest start that is not more than 7 is 5, so it shows 18.

Common VLOOKUP approximate match mistakes

The answer comes from the wrong band

Sort the first column of the band table from smallest to largest. Approximate match relies on that order, and an unsorted table gives answers you can't trust.

#N/A for a small number

Start the table at the lowest possible value, often 0. A number below the first band has no band to fall into, so VLOOKUP shows #N/A.

Every lookup gives #N/A on a band table

Change FALSE to TRUE, or leave the last part out. With FALSE, VLOOKUP only accepts a number that is listed exactly, like 5, not 7.

TRUE or FALSE in VLOOKUP?

Use TRUE (approximate) when the table lists bands: thresholds that each cover a range of numbers. Use FALSE (exact) when you look up a code, name or ID that must match exactly, like an invoice number. Most lookups are exact, which is why it's safer to always type the last part.

In Microsoft 365, Excel 2021 and Google Sheets, XLOOKUP can do the same band lookup with -1 as its fifth part, "exact match or next smaller", and it doesn't need the table sorted.

Questions people ask

Why must the first column be sorted for approximate match?

Approximate match stops at the last value that isn't bigger than yours. If the first column isn't sorted smallest to largest, it can stop in the wrong row.

What happens if a value is below the lowest band?

VLOOKUP returns #N/A. Start the band table at 0 so every value has a row.

What is the difference between TRUE and FALSE in VLOOKUP?

FALSE finds exact matches, for IDs and names. TRUE finds the band a value falls into, for grades, discounts and tax slabs.

Can XLOOKUP do an approximate match?

Yes. Set its match mode to -1 to get the next smaller value, and the table doesn't need sorting.

Theme