# How to sum if one column is greater than another in Excel

SUMIF can't compare two columns row by row, so use SUMPRODUCT: `=SUMPRODUCT((C2:C7>B2:B7)*C2:C7)`.

**Excel:** `=SUMPRODUCT((C2:C7>B2:B7)*C2:C7)` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D | E |
| --- | --- | --- | --- | --- |
| Project | Budget | Actual |  | Spend on over-budget projects |
| Website refresh | 18000 | 21450 |  |  |
| CRM rollout | 42000 | 39800 |  |  |
| Office move | 25000 | 27350 |  |  |
| Brand video | 12000 | 12000 |  |  |
| Data warehouse | 60000 | 58900 |  |  |
| Trade show | 15000 | 18620 |  |  |

Formula in F1: `=SUMPRODUCT((C2:C7>B2:B7)*C2:C7)`

Result: $67,420

## How it works

`C2:C7>B2:B7` compares each actual with the budget on the same row, giving TRUE for the three projects over budget. Multiplying by the actuals keeps those amounts and zeros the rest, and SUMPRODUCT adds them. The brand video hit its budget exactly and is not over.

## Other ways

- `=SUM(FILTER(C2:C7,C2:C7>B2:B7))`: Excel 365 and Google Sheets: FILTER keeps the over-budget actuals.
- `=SUMPRODUCT(--(C2:C7>B2:B7),C2:C7)`: The comma form, which also treats any text in the actuals as 0.

## Common mistakes

- `=SUMIF(C2:C7,">"&B2:B7)` doesn't compare row by row; it returns several results or the wrong total.
- If the over-budget amount itself is what you want, subtract the budget: see the first FAQ.

## Questions

**How do I sum only the overrun amounts?**

Use `=SUMPRODUCT((C2:C7>B2:B7)*(C2:C7-B2:B7))`, which gives 9,420 here.

**How do I sum rows where two columns are equal?**

Change the test: `=SUMPRODUCT((C2:C7=B2:B7)*C2:C7)`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/sum-if-one-column-is-greater-than-another
