Lookup Table
You'll join two tables by a shared key with a lookup, catch the rows that don't match, and use a range lookup for bands like tax rates or grades.
About
Most real sheets are two lists that need to talk to each other: orders and prices, people and teams, codes and names. A lookup pulls a value from the second list into the first by a key, and it's the formula that separates people who use spreadsheets from people who retype things. XLOOKUP is the one to learn if your software has it (Google Sheets, Excel, and LibreOffice from version 24.8), and INDEX with MATCH does the same job everywhere else. The two traps are a trailing space in a key, which matches nothing, and a VLOOKUP without FALSE at the end, which matches the wrong row and says nothing. What counts is lookups you wrote on two tables of your own, with the failures handled.
At a glance
- Per requirement
- 15 XP
- Completion bonus
- 75 XP
- Requirements
- 6
- Takes
- One evening
- Skill level
- Intermediate (months of practice)
- Cost
- Free
- Supplies
- Nothing special
- Where
- At home
- Other people
- On your own
Requirements
-
1
Build two tables that share a key column, with at least 30 rows in the main one. The main table is the long one, like purchases with an item code, and the lookup table is the short one, like item code to price and category. Put them on separate tabs. The key has to be unique in the lookup table, so check it with =COUNTIF(A:A,A2) filled down and make sure nothing says 2. Take a screenshot of both tables. Photo
-
2
Pull a value from the second table into the first with XLOOKUP, or INDEX and MATCH. Give the lookup columns names like Codes and Prices (named ranges are under Data in Sheets, Formulas in Excel and Sheet in LibreOffice), and then =XLOOKUP(A2,Codes,Prices) or =INDEX(Prices,MATCH(A2,Codes,0)) both do it. The 0 in MATCH and the FALSE in VLOOKUP mean exact match, and leaving them out is how you get a confident wrong answer. Fill it down the whole column. Take a screenshot with the formula visible. Photo
-
3
Make three keys fail on purpose and catch them. Misspell one key in the main table, add a trailing space to another, and delete a third from the lookup table. Show the errors, then catch them with IFERROR or XLOOKUP's not-found argument so the cell says 'not found' instead of #N/A. Fix the trailing space with TRIM in the key. Add a COUNTIF of the not-found cells at the top so you always know how many rows are missing. Film the error appearing and being caught, or take a screenshot of the three. Photo or video
-
4
Do a range lookup that puts a number into a band. Tax bands, grade boundaries, shipping cost by weight, or discount by quantity all work. Make a small table of lower bounds, sorted ascending, and use XLOOKUP with match mode -1, VLOOKUP with TRUE, or MATCH with 1. Then test the edges: a value exactly on a boundary, one just under, and one below the first band. Take a screenshot of the boundary tests next to the table. Photo
-
5
Do a lookup on two conditions and check it against a hand filter. Find a price by item and date, or a person by first and last name. Either build a helper column that joins both keys with &, or use FILTER, or SUMIFS when the answer is a number. Then filter the table by hand to the same two conditions and confirm you get the same row. Take a screenshot of the formula result and the filtered table side by side. Photo
-
6
Change one value in the lookup table and show every dependent row update. Change a price or a category on the lookup tab and watch the main table follow. This is why you look things up instead of retyping them: one change in one place. Film it. Video