# E1 | google/gemini-3.6-flash | 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

To sum all values in column B where the corresponding cell in column A equals "Paid", use the `SUMIF` function in Excel or Google Sheets. This function evaluates a criteria range against a specified condition and totals the matching numeric values in the sum range. 

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

## Formula Options and Comparison

While `SUMIF` is the most straightforward approach for a single condition, `SUMIFS` is often preferred in modern spreadsheet design because it allows you to easily add more criteria later.

| Formula | Description | Software Support |
| --- | --- | --- |
| `=SUMIF(A:A, "Paid", B:B)` | Standard single-criterion conditional sum [Excel SUMIF Guide](https://support.microsoft.com/en-us/office/sumif-function-169b8c99-c05c-4483-a712-1697a653039b). | Excel & Google Sheets |
| `=SUMIFS(B:B, A:A, "Paid")` | Multi-criteria conditional sum where the sum range comes first [Google Sheets SUMIFS Guide](https://support.google.com/docs/answer/3238496). | Excel & Google Sheets |
| `=SUMPRODUCT((A2:A100="Paid")*(B2:B100))` | Array-based formula for complex logic across defined ranges. | Excel & Google Sheets |

## Usage Notes

**Case Sensitivity**
Text matching in both `SUMIF` and `SUMIFS` is case-insensitive. Text entries matching "Paid", "paid", or "PAID" will all be included in the total.

**Range Performance**
Using full-column references like `A:A` and `B:B` works seamlessly in modern versions of Excel and Google Sheets. However, specifying explicit ranges (e.g., `A2:A1000` and `B2:B1000`) helps prevent calculation lag in exceptionally large workbooks.

Would you like to expand this formula to include additional conditions, such as filtering by date or customer name?
