Approximate match: bands and grades
Give each score a grade from a table of boundaries.
An approximate match finds the band a score falls in: the boundaries must be sorted smallest first.
Give each student their grade in C2:C9, using the grade boundaries in E1:F7. A score gets the grade of the highest boundary it reaches.
Typing formulas is easiest on a computer with a keyboard.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Student | Score | Grade | From | Grade | ||
| 2 | Oscar | 64 | 0 | F | |||
| 3 | Kofi | 70 | 40 | E | |||
| 4 | Quinn | 79 | 50 | D | |||
| 5 | Elif | 80 | 60 | C | |||
| 6 | Mateo | 78 | 70 | B | |||
| 7 | Nadia | 61 | 80 | A | |||
| 8 | Jamal | 51 | |||||
| 9 | Victor | 22 | |||||
| 10 | |||||||
| 11 | |||||||
| 12 | |||||||
| 13 |
How VLOOKUP and XLOOKUP works
What is an approximate match?
An exact match only finds values that are in the table. Bands work differently: a score of 67 isn't in a grade table, but it falls between the 60 and 70 boundaries, so it gets the grade for 60. An approximate match finds the largest value that is less than or equal to what you look up.
=VLOOKUP(B2,$E$2:$F$7, 2, TRUE) How should the band table look?
- One row per band, with the lowest value of each band in the first column: 0, 40, 50...
- Sorted from smallest to largest. On unsorted data an approximate match quietly returns wrong answers.
- Start at the lowest possible value (0 here). A score below the first band gives #N/A.
Why
TRUE?TRUEasks for an approximate match.VLOOKUPalso does one when the last part is left out, which is why forgettingFALSEin an ordinary lookup gives wrong answers. WriteTRUEso the next reader knows it is on purpose. A forgottenFALSEis one reason a lookup returns the wrong value.What else uses bands?
Tax rates, commission levels, shipping prices by weight and discounts by order size. In
XLOOKUP, use -1 as the match mode for "exact match or next smaller":=XLOOKUP(B2,$E$2:$E$7,$F$2:$F$7,,-1).
Know someone fighting with a spreadsheet? Send them this page.