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

To sum all values in column B where the matching cell in column A equals "Paid", use the `SUMIF` or `SUMIFS` function. Both formulas work seamlessly in Microsoft Excel and Google Sheets across entire columns or defined ranges.

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

Alternatively, using `SUMIFS`:

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

## How the Formulas Work

* **`SUMIF` Syntax**: `=SUMIF(range, criteria, [sum_range])`
  This structure checks the condition range (`A:A`) for the matching string `"Paid"` and adds up the numbers in the corresponding rows of the sum range (`B:B`) [Excel SUMIF Documentation](https://support.microsoft.com/en-us/office/sumif-function-169b8c99-c05c-4483-a712-1697a653039b).

* **`SUMIFS` Syntax**: `=SUMIFS(sum_range, criteria_range1, criteria1, ...)`
  This structure places the sum range (`B:B`) first. It is recommended if you plan to add multiple conditions later, such as filtering by date or category [Google Sheets SUMIFS Guide](https://support.google.com/docs/answer/3238496).

Both functions are case-insensitive, meaning `"Paid"`, `"paid"`, and `"PAID"` will all be included in the total.

Would you like to expand this formula to include additional conditions, such as filtering by a specific date range or vendor?
