# E1 | z-ai/glm-5.2 | run 1

## Prompt

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

## Response

Use the SUMIF function to conditionally sum values based on text criteria in another column. This formula works identically in both Excel and Google Sheets.

## Formula

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

## How It Works

- **A:A** — The range to evaluate against the criteria.
- **"Paid"** — The criteria; matches cells containing exactly the text "Paid".
- **B:B** — The range to sum when the corresponding cell in column A meets the criteria.

## Variations

| Scenario | Formula |
|---|---|
| Case-insensitive partial match (e.g., "Paid", "paid", "Partially Paid") | `=SUMIF(A:A, "*paid*", B:B)` |
| Exact row range instead of full column | `=SUMIF(A2:A100, "Paid", B2:B100)` |
| Multiple criteria (e.g., "Paid" in A and "Services" in C) | `=SUMIFS(B:B, A:A, "Paid", C:C, "Services")` |

For full documentation, see the [Google Sheets SUMIF guide](https://support.google.com/docs/answer/3093583) or the [Microsoft Excel SUMIF reference](https://support.microsoft.com/en-us/office/sumif-function-169b8c99-c05c-4483-a712-1697a6531329).

Would you like help adapting this formula to ignore case sensitivity or to match partial text like "Pending Payment"?
