Differentiate between SUM, SUMIF, SUMIFS and DSUM functions
Whenever you enter a function = SUM in a cell in Excel, you will get a lot of functions starting with SUM and wondering how they are different? This article will help you solve that question.
- 3 ways to calculate totals in Excel
- Calculate the subtotal of the list on Excel
- Calculate the total value of the filtered list in Excel
In this article we will cover four basic functions that are SUM, SUMIF, SUMIFS and DSUM.
Each function has its own function to synthesize numbers, we will learn each function one by one.
To better understand the function of each function, the article uses an example of a company's sales figure. This is a 1000-row data table, so the range of data will be from cell A1 to cell J1001.
SUM function
The SUM function functions to sum multiple individual cells, sum a range or even multiple ranges at once.
For example, sum all the number of sold cells (column I), using the following formula:
= SUM (I2: I1001)
Calculate the total selling price (column J), using the formula:
= SUM (J2: J1001)
SUMIF function
The SUMIF function performs summing based on a condition.
For example:
Sum up all the number of blue boxes sold, using the formula:
= SUMIF (G2: G1001, 'blue', I2: I1001)
Formula of SUMIF function:
= SUMIF (Range, Criteria, Sum_Range)
Inside:
- Criteria: is the condition for the function, in this example is blue. Conditions are not case sensitive, so you can write blue or BLUE, the function will still understand the conditions you give. Because the condition is text, day, it needs a sign '' . If the condition is numeric, you don't need this sign anymore.
- Range is the range containing criteria, in this example the range contains Blue, ie column G (Color).
- Sum_Range is the sum of the sum. In this case we need to calculate the total number so the range here is column I (Qty).
One thing to keep in mind is that the function order is not disturbed, first is Range, Criteria, and finally Sum_Range.
- How to combine Sumif and Vlookup functions in Excel
SUMIFS function
The SUMIFS function (note 's' in the function name) is summed based on multiple conditions, unlike the SUMIF function above that can only be summed based on a condition. You can also use this function with only one condition.
For example:
Summing up all the small, blue sized cells we will use the formula:
= SUMIFS (I2: I1001, G2: G1001, 'blue', F2: F1001, 'small')
Formula of SUMIFS function:
= SUMIFS (Sum_Range, Range 1, Criteria 1, Range 2, Criteria 2, ., Range n, Criteria n)
Inside:
- Sum_Range is the sum of the sum of SUMIFS functions set first. This is different from SUMIF function.
- Followed by Range and Criteria of each condition, similar to SUMIF.
All conditions in SUMIFS are conditions And, not conditions Or. Therefore, there are no two conditions for the same column. If you do so, the formula will be a little different, we will learn in the next section.
Similarly, you must not disturb the order of functions.
As mentioned above, you cannot use two conditions in the same column but if you want to calculate the total number of green and yellow cells (in the same column G), we use the following formula:
= SUMIFS (I2: I1001, G2: G1001, 'blue') + SUMIFS (I2: I1001, G2: G1001, 'yellow')
According to the above formula, we combine two SUMIFS functions to facilitate Or. You can use a combination of two SUMIF functions to calculate the sum.
DSUM function
Now, if you need to calculate the number of blue, black, yellow and pink cells, how to use the formula? You can use SUMIFS + SUMIFS + SUMIFS + SUMIFS function as above.
However, what if you want to calculate the total of 20 colors in the 40-color box in the box?
Instead of writing = SUMIFS + SUMIFS + SUMIFS + SUMIFS + . . 20 times, you simply need to use DSUM function. DSUM function allows you to create conditions outside the formula.
Let's take an example for you to understand this function better.
To calculate the total number of blue, yellow and black cells, create conditions outside the data table.
You need to write the column header first, in this case Color . Below you write each condition to be summed in each row. When writing this condition under the other condition, you are creating conditions Or.
The formula will be:
= DSUM (A1: J1001, I1, M21: M24)
General formula for DSUM functions:
= DSUM (Database, Field, Criteria)
Inside:
- Database: is the entire scope of data. In this case, A1: J1001.
- Field: is the title of the column to be summed, in this example is column Qty (I1).
- Criteria are the range of data you create outside. Here is the range from cell M21 to M24.
Example 2:
To calculate the total number of green, small, and large black cells, similar to the above we need to create external conditions.
When writing criteria side by side means you are facilitating And, writing this criterion below the other criterion means facilitating Or.
The formula used to calculate the total according to the above conditions is:
= DSUM (A1: J1001, I1, M28: N30)
You should read it
- SUMIF and SUMIFS functions - specific usage and examples
- Sumif and Sumifs functions in Excel
- How to combine Sumif and Vlookup functions in Excel
- PHP functions
- How to fix the SUM function doesn't add up in Excel
- How to use the IFS function in Excel 2016
- How to use Excel's VALUE function
- Function in C / C ++
- The MIN and MAX functions (the smallest and largest value functions) in Excel
- Basic Excel functions that anyone must know
- Shell functions
- How to use functions in Less CSS
Maybe you are interested
How to turn a photo into a painting using the Generative Fill function in Photoshop
How to use the TREND function in Excel
Google Sheets Functions to Simplify Your Budget Spreadsheets
Instructions for using the TRIMRANGE function to clean up Excel tables
How to master numerical data in Google Sheets with the AVERAGE function
Don't buy headphones if they lack this important function!