# E9 | z-ai/glm-5.2 | run 1

## Prompt

Write a spreadsheet formula that looks up the price of the product named in cell D2 from a table in columns A (names) and B (prices).

## Response

To look up the price of a product named in cell D2 from a table with names in column A and prices in column B, you can use either the modern `XLOOKUP` function or the classic `VLOOKUP` function. `XLOOKUP` is generally preferred as it is more robust and easier to read, while `VLOOKUP` is compatible with older versions of spreadsheet software.

### Modern Approach (Excel 365, Excel 2021, Google Sheets)

```excel
=XLOOKUP(D2, A:A, B:B)
```

### Classic Approach (All Excel Versions)

```excel
=VLOOKUP(D2, A:B, 2, FALSE)
```

**How it works:**
- **XLOOKUP**: Searches for the value in `D2` within column `A` (`A:A`) and returns the corresponding value from column `B` (`B:B`).
- **VLOOKUP**: Searches for `D2` in the first column of the range `A:B`, and returns the value from the 2nd column of that range. The `FALSE` argument ensures it looks for an exact match.

Which spreadsheet application are you using?
