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

## 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

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

Alternatively, using the newer `XLOOKUP` function:

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

**How it works**
- `VLOOKUP` searches for the value in `D2` within the first column of the range `A:B`, then returns the value from the second column (`2`). The `FALSE` argument ensures an exact match.
- `XLOOKUP` is more modern and flexible. It looks for `D2` in `A:A` and returns the corresponding value from `B:B`. It defaults to an exact match.

Both formulas work in Excel and Google Sheets, though `XLOOKUP` requires a recent version of Excel or Google Sheets.

Would you like the formula to handle cases where the product name is not found, such as returning a custom message instead of an error?
