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:
The condition for this sum is the payment date (empty = unpaid, not empty = paid).
Enter in the SUMIF function:
- range: the range of cells where the criterion is verified (here, the payment dates)
- criterion: the criterion "" (= empty)
- sum_range: the range of cells that will be used for the sum calculation (here, the amounts)
The formula is:
=SUMIF(C2:C11,"",B2:B11)
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)
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.