# E9 | anthropic/claude-haiku-4.5 | 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

This is a straightforward VLOOKUP formula that retrieves the price from your lookup table:

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

**How it works:**
- `D2` — the product name to search for
- `A:B` — the table range (names in column A, prices in column B)
- `2` — returns the value from the 2nd column (prices)
- `FALSE` — requires an exact match

**Alternative formulas:**

If your table isn't organized with names first, use **INDEX/MATCH** for more flexibility:

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

For newer Excel versions (2021+) or Google Sheets, **XLOOKUP** is simpler:

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

All three formulas return `#N/A` if the product name isn't found. To handle missing values gracefully, wrap any formula with `IFERROR()`:

```excel
=IFERROR(VLOOKUP(D2,A:B,2,FALSE),"Not found")
```

Are you working with a large dataset or do you need to handle duplicate product names?
