A price list
Imagine your class wants to buy snacks based on the survey. How much would it cost? You need a price list and XLOOKUP.
Make a price list
-
Add a new sheet called
Prices. -
Type
Snackin A1 andPricein B1. -
Fill it in: sandwich 3, apple 1, cookie 2, banana 1, nothing 0.
A list like this is called a lookup table. The prices are in one place. When a price changes, you only change it here.
Find the price for each answer
-
On the
Answerssheet, typePricein D1. -
In D2, type
=XLOOKUP(C2,Prices!A:A,Prices!B:B,"?"). -
Drag D2 down to D21. Every answer has a price.
-
Under the table, in C23, type
Total, and in D23,=SUM(D2:D21). You’ll see $37.
Prices!A:A means the whole column A on the Prices sheet. When you add another snack to the price list, the formula finds it too.
Try raising the price of a sandwich to $4. The total changes by itself.
The question mark
If the answers had a snack that isn’t on the price list, XLOOKUP would write ?. That’s the fourth part of the formula. You can see right away what’s missing from the price list.
The words have to be written exactly the same. sandwich and sandwich (with a space) are two different things to XLOOKUP. That’s why we look in column C, which we cleaned up in Sorter.
당신 차례 💪
- You have a
Pricessheet. - Every answer has a price.
- You know how much snacks for the whole class would cost.
Done when: the spreadsheet finds the price for every answer.
What to take away from this lesson
- Lookup table = a list kept in one place.
- XLOOKUP finds a value in the lookup table.
?shows what’s missing.- The words have to be written the same way.
© 2026 Ing. Martin Polak / AlgoRhino · 콘텐츠 이용 약관