SUMIF formula and example in Excel and Google Sheets
Formula, examples and how to use it=SUMIF(range, criterion, [sum_range])
One of the most popular functions used in Excel and Google Sheets, and returns a conditional sum across a range. In this exercise, we will analyze the total revenue of the top 5 company 2020 and the same method can be used for profits and employees.
SUMIF formula and example in Excel and Google Sheets
SUMIF FORMULA AND EXAMPLE AND RESULT — EXCEL AND GOOGLE SHEETS EXAMPLE
In the above datasheet, let's find out the total revenue for the "Oil and gas" industry. Since our data set is small we can simply sum the individual cell D4+D7 and we will get the result. If we have 1000s row of the data we can use the SUMIF function to get the result and the formula will look like this.
=SUMIF(C3:C7,"Oil and gas",D3:D7) // a text criteria within formula must be inside quotation marks " "
=SUMIF(C3:C7,B12,D3:D7) // criteria as a cell reference
C3:C7 = criteria_range
"Oil and gas" = criteria
D3:D7 = sum_range
💡 "Oil and gas" = criteria are not case sensitive "Oil and Gas", "OIL AND GAS", "Oil And Gas" will produce the same result. As long we have the same text within the criteria, we will get the same result
💡 "1 Oil and Gas", "1 OIL AND GAS", "1 Oil And Gas" will NOT produce the same result.
💡 Access the Google Sheets here used in this exercise. All functions on this page are compatible with Microsoft Excel and the same analysis can be made in Excel
💡 Below explained, how to sum if a text contains part of the string
How to SUMIF cells if contains part of a string
HOW TO SUMIF CELLS IF CONTAINS PART OF A TEXT STRING — EXCEL AND GOOGLE SHEETS EXAMPLE
=SUMIF(C3:C7,"*Oil and gas*",D3:D7) // a text criteria within formula must be inside quotation marks " "
=SUMIF(C3:C7,"*"&B11&"*",D3:D7) // criteria as a cell reference
C3:C7 = criteria_range
"*Oil and gas*" = criteria
D3:D7 = sum_range
=SUMIF(C3:C7, "Oil and gas", D3:D7) this will return 0 value in the above data set
💡 Wildcard: The * character allows for any number (including zero) of other characters to take its place.
💡 In this example, it’s used to find all cells that include the text "Oil and gas". This search is not case-sensitive, so "Oil and gas" are considered the same as "OIL AND GAS" or "Oil And Gas".
💡 Access the Google Sheets here used in this exercise. All functions on this page are compatible with Microsoft Excel and the same analysis can be made in Excel
💡 Below explained, how to sum if a text contains part of the string
How to SUMIF cells start with a certain value
HOW TO SUMIF CELLS START WITH A CERTAIN VALUE — EXCEL AND GOOGLE SHEETS EXAMPLE
=SUMIF(C3:C7,"1*",D3:D7) // a text criteria within formula must be inside quotation marks " "
=SUMIF(C3:C7,B11&"*",D3:D7) // criteria as a cell reference
C3:C7 = criteria_range
"1*" = criteria // must start with 1
D3:D7 = sum_range
=SUMIF(C3:C7, "1", D3:D7) this will return 0 value in the above data set
"1*": to sum a value start with a certain condition must be followed by an asterisk (*) like the above example.
Asterisks explanation
"a" at start = a*
"b" at end = *b
💡 Access the Google Sheets here used in this exercise. All functions on this page are compatible with Microsoft Excel and the same analysis can be made in Excel
💡 Below explained, how to sum if a text contains part of the string
How to SUMIF cells end with a certain value
HOW TO SUMIF CELLS END WITH A CERTAIN VALUE — EXCEL AND GOOGLE SHEETS EXAMPLE
=SUMIF(C3:C7,"*gas",D3:D7) // a text criteria within formula must be inside quotation marks " "
=SUMIF(C3:C7,"*"&B11,D3:D7) // criteria as a cell reference
C3:C7 = criteria_range
"*gas" = criteria // must end with gas
D3:D7 = sum_range
=SUMIF(C3:C7, "gas", D3:D7) this will return 0 value in the above data set
"*gas": to sum a value end with a certain condition must start with an asterisk (*) like the above example.
Asterisks explanation
"a" at start = a*
"b" at end = *b
💡 Access the Google Sheets here used in this exercise. All functions on this page are compatible with Microsoft Excel and the same analysis can be made in Excel
- SUMIFS formulas and example
- COUNTIF formulas and example
- IF formulas and example
- TEXT formulas and example
- CONVERT formulas and example
- Sum by month
- SUMIF cells if contains part of a text string
- Sum total sales based on quantity & price
- Combine date and time
- Convert 1-12 to month name
- Dynamic current date and time
- Count blank cell
- Count cell between two values
- Combine two or more cell
- Extract left before first space
- Extract the nth words in a text string
- Flip the first and last name
- SUMIF formulas and example
- SUMIFS formulas and example
- Change the negative number to zero
- Change negative to positive numbers
- Calculate percentage changes for containing zero or negative values
- Convert date to text
- Convert time to text
- Convert weekday string to number
- Combine two or more cells with a line break
- Combine two or more cells and transpose
- Count cells over 10 characters
- Count cells that are not blank
- Count if cells contain a specific text
- Count cells that begin with a specific text
- COUNTIF based on multiple criteria