Use the SUMIF function to calculate sums containing conditions in Excel
- 24-07-2022
- trienkhaiweb
- 0 Comments
You are calculating the total wages to be spent on employees of a company A this March. However, the payroll includes the list of team leaders and department heads. That, makes you have to choose very time consuming. So why don't you use the SUMIF function to calculate it quickly. However, how to use it, please follow the following article of Web888.
If the SUM function is used to sum values, the SUMIF function helps you perform the conditional sum calculation. Therefore, for problems that calculate sums but contain attached conditions, you must use the SUMIF function.
The content of the article consists of 2 parts:
- Introduction to the SUMIF . function
- Illustrated example of the SUMIF . function
Mục lục
1. Introduction to the SUMIF . function
As mentioned above, the SUMIF function is a sum function containing a condition in Excel.
Note: For functions containing two or more conditions, you must use the SUMIFS function, with this SUMIFS function you only use Excel 2007 or later versions.
The syntax is as follows:
=SUMIF(range, criteria,sum_range)
In there:
- Range (required): Is the selection containing the condition cells. Cells in the selected range must be numbers or names, arrays or references containing numbers…
- Criteria (required): A condition to execute the function. The criteria here can be in the form of numbers, expressions, numeric references, text cells, or a function that determines which cells to add. All criteria must include a Logic, or mathematical symbol, must be enclosed in quotation marks (") except for numeric criteria.
- Sum_range : The area to be summed.
For example, we have the following data table:
Can you calculate the total score of the female students?
From that table we have the formula:
=SUMIF(C2:C6,"female",D2:D6) you will get the following table of results:
2. Example of SUMIF . function
We have the following data table:
Ask you to:
- Calculating the total salary and bonus of employees need to pay?
- Calculate the total bonus of those with less than 3 million dong?
To solve this problem, do the following:
First, calculate the employee's total salary:
First we need to define:
- The container containing that condition is the position column from C2->C8.
- Conditions: only for those who are "employees".
- The main totaling area is the salary column from E2->E8.
From there we enter the following formula:
=SUMIF(C2:C8,"employee",E2:E8) we get 35,000,000.
Similarly, you have the following bonus calculation formula:
=SUMIF(C2:C8,"employee",D2:D8) we get the result: 5,000,000.
Next, to calculate the total bonus of those who have a bonus of less than 3 million VND, you proceed as follows:
First of all, this is the summation form as long as the larger value is smaller. Therefore, you have to do it a little differently.
We see, the condition here is less than 3 million, you cannot enter the formula with such text. Instead, you need to use the signs in math that are: <, >, = to conduct the comparison.
In this case, the condition is less than 3 million, so you need to use the "<" operator to do it.
From there we have the following formula:
=SUMIF(D2:D8,”<”&3000000,D2:D8) we get 5000000.
Note: When writing comparison formulas, you should use opening and closing quotes for the operators you use and add "&" so that Excel understands what you mean.
Thus, we get a complete table of results for the problem as shown below. When you click on each result cell it will show the formula on the toolbar. Therefore, if you want to review the formula, you can perform that operation to see it.
Thus, I have shown you how to use the SUMIF function. With this function, when you define the condition, you can write the formula quickly. Compared to using the SUM function or using the AVERAGE function , the SUMIF function is somewhat more difficult. However, if you do not understand, you can comment below, I will guide you more specifically.
Thank you for watching!