To get the sum of all numbers, you can use the SUM function. If you need to get the sum of the numbers that meet one criterion, you will need to use the SUMIF function.
Example: You are working with the data that include the employee salaries, and you need to get the sum of employees' total income for each gender.
The employee's gender is in column A and the employees' salaries are in column B.
Formula 1: To get the total salaries of all males, please use the following formula:
=SUMIF(A2:A11,"M", B2:B11), the result returns $338,000.
Formula 2: To get the total salaries of all females, please use the following formula:
=SUMIF(A2:A11, "F", B2:B11), the result returns $542,000.
Notes: The SUMIF function
The SUMIF function adds all the numbers with the criteria you specified.
=SUMIF(range, criteria, [sum_range])
– The range is required, which is the criteria range.
– The criterion is required, the criteria for the sum.
– Sum_range is optional, the cells to add together.