Google Sheets Function: SUMIF

The SUMIF function allows summing a range of cells based on a criterion.

Usage:

=SUMIF(range, criterion)

or (if the sum range is different)

=SUMIF(range, criterion, sum_range)


Usage Example

The SUMIF function here is used to calculate the total amount of unpaid invoices:

google sheets total unpaid sumif

The condition for this sum is the payment date (empty = unpaid, not empty = paid).

Enter in the SUMIF function:

The formula is:

=SUMIF(C2:C11,"",B2:B11)
google sheets sumif empty

To get the total of paid amounts using the same formula, replace the criterion "" (empty) with the criterion "<>" (not empty):

=SUMIF(C2:C11,"<>",B2:B11)
google sheets sumif not empty
If needed, you can copy the Google Sheets document (or view the document) with this example.

If you need to define additional criteria, use the SUMIFS function.

Tip: it is possible to use wildcard characters with this function.