# E9 | deepseek/deepseek-v4-pro | 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

## Spreadsheet Formula for Product Price Lookup

The most straightforward approach uses **VLOOKUP**:

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

This searches for the exact product name from D2 in column A and returns the matching price from column B.

---

### Alternative Formulas

**XLOOKUP** (Excel 365, Excel 2021, Google Sheets)

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

XLOOKUP is cleaner and more robust — it won't break if you insert or rearrange columns. You can also add a custom message for missing products:

```excel
=XLOOKUP(D2, A:A, B:B, "Not found")
```

**INDEX/MATCH** (all versions, all spreadsheet apps)

```excel
=INDEX(B:B, MATCH(D2, A:A, 0))
```

This combination works identically in Excel and Google Sheets, regardless of version. The `0` ensures an exact match.

---

### Key Differences

| Formula | Exact Match | Column Order Independent | Error-Handling Built In | Works in All Versions |
|---|---|---|---|---|
| VLOOKUP | FALSE (4th arg) | No | No | Yes |
| XLOOKUP | Default | Yes | Yes (4th arg) | Excel 365/2021, Google Sheets |
| INDEX/MATCH | 0 (3rd arg) | Yes | No | Yes |

For broad compatibility, use **INDEX/MATCH**. For modern convenience, use **XLOOKUP**.

---

Would you also like help wrapping the formula with error handling, such as IFERROR, to show a friendly message when a product isn't found?
