- You can use
SUMIF inGoogle Sheets to add numbers together that are associated with a daterange , specific text, or meet a numeric criterion. - Here's everything you need to know to use the SUMIF function in Google Sheets.
It's easy to add a set of numbers together - every spreadsheet user knows how to use the tried-and-true
That's where Google Sheets' SUMIF function comes in. You can use SUMIF to calculate a sum based on a condition. That condition can be built into the set of values themselves, or numbers that are related to a neighboring row or column. If that sounds complicated, the good news is that it's easy to apply.
How to use the SUMIF function in Google Sheets
As the name of the function implies, SUMIF is conditional and checks for a status using the IF function before totaling your numbers. This is what the function looks like:
=SUMIF(range, criterion, [sum_range])
- Range: The range is the set of cells that you want to test against some sort of criterion.
- Criterion: This is what you want to use to test against the range. The SUMIF function is pretty versatile - you can use a number, text, or even a date as the criterion.
- Sum_range: The sum_range is optional, and is what gives this function so much power. If you omit the sum_range, the function will sum the range. But you have the option of summing a different range depending on the result of the conditional test.
How to use SUMIF with a simple number condition
Even with the optional sum_range argument, the SUMIF function isn't difficult to use, but the easiest way to see it in action is by adding a range of values based on a criterion in that range. For example, suppose you have a spreadsheet like this one, and you are interested in the sum of all the numbers that are 100 or higher.
- Type "=SUMIF" and press the Tab key. Google Sheet will automatically add the open parenthesis and wait for the range.
- Click and drag the mouse to select the column with the numbers you want to sum.
- Type a comma and then enter ">=100" (including the quotes).
- Press the Tab key. Google Sheets will add the closing parenthesis and you should see the result in the cell. We didn't need to specify a sum_range because in this example it's just the same as the range.
How to use SUMIF with a text condition
Suppose you had a similar spreadsheet, but it was a tally of sales by region. If you only wanted the sum of sales in the east region, you could use SUMIF with a text criterion, and add the optional sum_range to specify where the argument should find the values to sum. Consider this spreadsheet:
- Type "=SUMIF" and press the Tab key. Google Sheet will automatically add the open parenthesis.
- Click and drag the mouse to select the column with the names of the regions.
- Type a comma and then enter "East" (including the quotes).
- Type a comma and then select the column with the sales figures.
- Press the Tab key. Google Sheets will add the closing parenthesis and you should see the result in the cell.
How to use SUMIF with a date condition
The SUMIF function can even sum numbers based on a date - such as values related to a specific date, or before or after a date. Suppose we want to total all the sales that happened on January 15.
- Type "=SUMIF" and press the Tab key. Google Sheet will automatically add the open parenthesis.
- Click and drag the mouse to select the column with the range of dates.
- Type a comma and then enter "DATE(2021, 1,15)" (do not include the quotation marks).
- Type a comma and then select the column with the sales figures.
- Press the Tab key. Google Sheets will add the closing parenthesis and you should see the result in the cell.
In this example, we added together all the numbers that occurred on January 15, 2021, but you can also sum the numbers that happened before that date or after that date.
To sum everything on or before that date, enter the criterion like this: "<="&DATE(2021, 1,15). In this case, the less than and equals to symbols are "concatenated" to the date with the ampersand (&) symbol, and the less than and equals to symbols are in quotes.
Likewise, to sum everything after that date, enter the criterion like this: ">"&DATE(2021, 1,15).
How to use SUMIF with a wildcard
Wildcards are handy because they let you work with partial matches, such as any product that has the word "apple" in it.
- Type "=SUMIF" and press the Tab key. Google Sheet will automatically add the open parenthesis.
- Click and drag the mouse to select the column with the names of the products.
- Type a comma and then enter "*apple*" (include the quotation marks).
- Type a comma and then select the column with the sales figures.
- Press the Tab key. Google Sheets will add the closing parenthesis and you should see the result in the cell.
In this example, we are looking for the word "apple" to appear anywhere in the cell, so we put an asterisk both before and after the word - this way it included apple at the end of the cell, like "Green Apples," and apple at the start of the cell, like "Apple Butter." If you prefer, you could write just "*apple" to only include cells in which apple appears at the end of the cell.
Tips for using SUMIF in Google Sheets
Once you've used the SUMIF function a few times, you'll probably find that it's pretty straightforward, both with and without the optional argument. But here are a few tips to keep in mind to get the most out of SUMIF:
- The SUMIF function can only be used to evaluate one condition. If you need to work with several criteria at once, you might need to switch to the SUMIFS function.
- When you use the optional sum_range, it doesn't have to be right next to the range, but it does need to include the same number of cells.
- If you include a text argument in SUMIF, it isn't case-sensitive - and you can't make it case-sensitive, so it will treat "apple," "Apple," and "APPLE" the same way.
- Remember to use quotes to enclose elements like text and logical operators, like "apple" and ">=1"
- If you need to combine two elements in the argument - like a greater than operator and date, for example, use an ampersand to join them.