Documents & spreadsheets guide
How to use VLOOKUP and XLOOKUP to look up prices and details
Short answer
XLOOKUP finds a value in one column and returns the matching value from another, for example =XLOOKUP(A2, Items!A:A, Items!C:C, "Not found") returns the price for the code in A2. VLOOKUP does the same if the code is the first column of the table: =VLOOKUP(A2, Items!A:C, 3, FALSE). Always use exact match. Both work in Raaj Office Sheets, Excel and Google Sheets.
You have an order sheet with item codes, and a separate item list with names and prices. Instead of copying prices by hand, a lookup formula fills them in and updates when the price list changes.
The example tables
Items sheet:
| A: Code | B: Name | C: Price |
|---|---|---|
| BLT-M8 | Bolt M8 × 30 | 4 |
| DRL-13 | Drill 13 mm | 2100 |
| TAP-20 | Tape 20 m | 85 |
Order sheet: column A has codes, and you want the price in column C.
XLOOKUP (recommended)
In the order sheet, cell C2:
=XLOOKUP(A2, Items!A:A, Items!C:C, "Not found")
Read it as: look for A2 in the Items code column, return the value from the Items price column, and show "Not found" if the code isn't there. Fill it down the column.
Why XLOOKUP is easier:
- the lookup column doesn't have to be the first column;
- you choose the return column directly, so inserting columns doesn't break it;
- a "not found" message is built in.
VLOOKUP (older, everywhere)
=VLOOKUP(A2, Items!A:C, 3, FALSE)
Look for A2 in the first column of Items!A:C and return the 3rd column. The final FALSE means exact match: always include it for codes and names, or you may get a wrong nearby value.
Fixing #N/A and other errors
| Problem | Cause | Fix |
|---|---|---|
#N/A |
Code not found | Check spelling; extra spaces; codes stored as numbers in one table and text in the other |
| Wrong price | Approximate match | Use FALSE in VLOOKUP, or XLOOKUP |
| Breaks after inserting a column | VLOOKUP column number | Switch to XLOOKUP |
| Ugly errors in a printout | Missing codes | Wrap in IFERROR(…, "") |
Hidden spaces are the most common cause of #N/A. Clean imported data first (see how to open a CSV file in Excel format).
Totals by condition: SUMIFS
To total the quantity of one code across an order sheet:
=SUMIFS(B:B, A:A, "BLT-M8")
For bigger summaries, use a pivot table.
In Raaj Office
Raaj Office Sheets supports XLOOKUP, VLOOKUP, IFERROR, SUMIFS and about 180 other functions, with autocomplete that shows each function's description and arguments as you type. Files save as XLSX, so formulas keep working in Excel.
Frequently asked questions
Does XLOOKUP work in older Excel?
XLOOKUP is available in recent versions of Excel; for older versions or for sharing widely, VLOOKUP is the safe choice.
Can a lookup return several matches?
A lookup returns the first match. To list all matches, use FILTER, which Raaj Office also supports.
Is my data uploaded?
No. Raaj Office keeps files in your browser.