How to use the SUBTOTAL function in Excel
The following article will guide you to read how to use the SUBTOTAL function in Excel.
SUBTOTAL function in Excel
The SUBTOTAL function has the syntax = SUBTOTAL (function_num, ref1, [ref2], .) . Inside:
- Function_num: The numbers 1 through 11 and 101 through 111 specify which function will be used for calculation in SUBTOTAL.
- Ref1, Ref2,…: 1 or more cells, or range of cells for subtotaling, up to 254.
Note:
- The SUBTOTAL function is designed to calculate vertical columns of data.
- If the arguments ref1, ref2,… contain the SUBTOTAL function, they will be ignored to avoid double duplication.
- If function_num is between 1 and 11, the SUBTOTAL function calculates including hidden values in the dataset because the row containing the range is hidden. If function_num is 101 through 111, then SUBTOTAL calculates only values that are not hidden in the data set (hidden row values are excluded).
- For the data hidden by Filter, SUBTOTAL will ignore it.
The example uses the SUBTOTAL function
1. Sum the filtered rows
To understand this type of sum, refer to the article Calculate a filtered list value in Excel.
2. Count filtered cells that are not blank
We will use SUBTOTAL 3 or SUBTOTAL 103. However, if there is a hidden row, you must use SUBTOTAL 103 to count the cells that are not blank.
For example, the above data table will hide 2 rows, 4 and 5. Using SUBTOTAL 3 or SUBTOTAL 103 will produce 2 different results.
We enter formulas and then Excel will automatically display the set of functions for you to choose from without having to remember.
The result using SUBTOTAL 3 will yield 3, including hidden cells in the row.
The SUBTOTAL 103 will only show the nonblank cells we see, ignoring the hidden row.
3. Ignore values in nested Subtotal formulas
For example, we will calculate the average total kg of fabric of warehouses A1 and A2.
The average formula for the warehouse A2 = SUBTOTAL (1, C2: C4) and gives the result 19.
The average formula for the warehouse A1 = SUBTOTAL (1, C5: C7) will yield 38.
However, when averaging the total number of fabrics in 2 warehouses, the previous average result will be ignored. We have the formula = SUBTOTAL (1, C2: C9) and the result will automatically remove the average result. Binh calculated earlier.
How to error when executing SUBTOTAL function in Excel
When you calculate the SUBTOTAL function in Excel, some basic errors are encountered:
- #VALUE! Function identification numbers are not in the range 1-11 or 101-111 or have reference (ref) that is a 3D reference.
- # DIV / 0! Occurs when a specific sum must be divided by 0 (for example, the arithmetic mean or the standard deviation of a range of cells with no numeric values)
- #NAME? The SUBTOTAL function name is misspelled.
You should read it
- Tips for quickly calculating Totals in Excel
- Calculate the subtotal of the list on Excel
- Basic Excel functions that anyone must know
- How to use the SUM function to calculate totals in Excel
- How to use the MOD function and QUOTIENT function in Excel
- How to use the WRAPROWS function in Excel
- How to fix the SUM function doesn't add up in Excel
- How to use Hlookup function on Excel
May be interested
- How to use the MOD function and QUOTIENT function in Excelinjury in excel has many ways of doing it, can be used manually or using the calculation function.
- 8 little-known Excel functions that can save you a lot of workeven seasoned excel users often find themselves stuck performing tasks manually that could be automated with a few clever functions.
- How to use MID functions to get strings in Excelmid function in excel is a function that takes the middle character string corresponding to the value that the user requires to perform.
- How to use Excel's VALUE functionexcel's value function will convert a string to a digital form, which can be combined with other functions such as left function, right function, mid function.
- How to use the WRAPROWS function in Excelhaving trouble with handling large data sets in excel? then learn how to use the wraprows function to split them into more manageable rows.
- How to use the IFS function in Excel 2016the ifs function in excel is a logical function introduced in excel 2016. this function is a function that replaces the nested if function and is much easier to use. the ifs function checks one or more conditions and returns a value that meets the first true condition.
- How to use the NPER function in Excel to plan loans and savingsdo you want to effectively manage and control your personal finances? then we invite you to learn how to use excel's nper function.
- How to use the function to delete spaces in Exceldeleting white space with functions in excel makes it easier for users to handle content, instead of traditional editing.
- How to fix the SUM function doesn't add up in Excelin the process of summing with sum in excel, you will encounter some errors such as not jumping the number, not adding the sum. so how to handle this problem?
- Save time with these text formatting functions in Microsoft Excelmicrosoft excel is a main application for anyone who has to work with numbers, from students to accountants. but its usefulness extends beyond a large database, it can do a lot of great things with text. the functions listed below will help you analyze, edit, convert, change text and save many hours of boring and repetitive tasks.