Spreadsheet Practice

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

Formula (Excel and Google Sheets)

=SUMPRODUCT((C2:C7>B2:B7)*C2:C7)

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

Result on the example
$67,420 in F1
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in F1. Change any input and the result updates, or edit the formula to experiment.

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.

=SUMPRODUCT((C2:C7>B2:B7)*C2:C7)

Result67420

  1. C2:C76 rows × 1 col: $21,450, $39,800, $27,350, $12,000, …

    A range: 6 cells in one column.

  2. B2:B76 rows × 1 col: $18,000, $42,000, $25,000, $12,000, …

    A range: 6 cells in one column.

  3. C2:C7>B2:B7{6 rows × 1 col} TRUE, FALSE, TRUE, FALSE, …

    The > operator tests greater than.

  4. C2:C7>B2:B7)*C2:C7{6 rows × 1 col} 21450, 0, 27350, 0, …

    The * operator multiplies.

  5. SUMPRODUCT((C2:C7>B2:B7)*C2:C7)67420

    SUMPRODUCT: Multiplies arrays row by row and adds the results.

    • array1C2:C7>B2:B7)*C2:C7{6 rows × 1 col} 21450, 0, 27350, 0, …

In Google Sheets

The same formula works in Google Sheets: =SUMPRODUCT((C2:C7>B2:B7)*C2:C7). We ran it in Google Sheets mode on the same data and it returns $67,420.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=SUM(FILTER(C2:C7,C2:C7>B2:B7))$67,420Excel 365 and Google Sheets: FILTER keeps the over-budget actuals.
=SUMPRODUCT(--(C2:C7>B2:B7),C2:C7)$67,420The 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.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Sum if one column is greater than another

In F1, total the actual spend of the projects whose actual is greater than their budget.

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).

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.