# E1 | anthropic/claude-opus-5 | run 2

## Prompt

Write a spreadsheet formula (Excel/Sheets) that sums all values in column B where the matching cell in column A equals 'Paid'.

## Response

```excel
=SUMIF(A:A,"Paid",B:B)
```

This works identically in Excel and Google Sheets.

## How It Works

| Argument | Value | Purpose |
|---|---|---|
| `range` | `A:A` | Cells to test against the condition |
| `criteria` | `"Paid"` | The match value (not case-sensitive) |
| `sum_range` | `B:B` | Cells actually added up |

Rows where A contains "Paid" contribute their column B value; all others are ignored.

## Useful Variations

**Reference a cell instead of hardcoding the text** — easier to change later:

```excel
=SUMIF(A:A,D1,B:B)
```

**Limit to a defined range** (faster on large files, avoids header issues):

```excel
=SUMIF(A2:A1000,"Paid",B2:B1000)
```

**Exact case-sensitive match** — `SUMIF` treats "paid", "PAID", and "Paid" as the same, so use this if case matters:

```excel
=SUMPRODUCT(EXACT(A2:A1000,"Paid")*B2:B1000)
```

**Multiple conditions** — e.g. "Paid" in A and a date on/after 1 Jan 2026 in C:

```excel
=SUMIFS(B:B,A:A,"Paid",C:C,">="&DATE(2026,1,1))
```

Note that `SUMIFS` reverses the argument order: the sum range comes *first*.

## Common Pitfalls

Trailing spaces in column A ("Paid ") will break the match — wrap with `TRIM` in a helper column or use a wildcard: `=SUMIF(A:A,"Paid*",B:B)`.

Numbers stored as text in column B return 0. Check with `=ISNUMBER(B2)`.

Reference docs: [SUMIF function](https://support.microsoft.com/en-us/office/sumif-function-169b8c99-c05c-4483-a712-1697a653039b) and [Sheets SUMIF](https://support.google.com/docs/answer/3093583).

Do you need this to work across multiple sheets or a filtered/visible-rows-only subset?
