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

Here's a VLOOKUP formula that retrieves the price:

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

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

**Alternative using INDEX/MATCH** (more flexible):

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

This combination is often preferred because it doesn't require the lookup column to be first and handles dynamic ranges better.

**If using Google Sheets**, both formulas work identically. For newer Excel versions, you can also use:

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

XLOOKUP is simpler and handles errors more gracefully.

What happens if a product name in D2 doesn't exist in your lookup table—should the formula display an error message, a default value, or remain blank?
