SUBTOTAL is one of the default functions of Microsoft Excel. This function provides the opportunity to perform a group of Excel function operations. We can apply different Excel functions by inserting this function. In this article, we will discuss how to use this Excel SUBTOTAL function with examples and proper illustrations.
This is an overview of the SUBTOTAL function. In the below sections we will describe how to use this function in detail.
Download Practice Workbook
Download the following practice workbook to exercise while you are reading this article.
Introduction to SUBTOTAL Function
The SUBTOTAL function returns a list or database. It’s in Math/Trig function category. It offers 11 Excel functions to perform by inserting the corresponding argument.
|function_num||Required||This number ranges from 1 to 11 or 101 to 111 specifies which function will be used for the SUBTOTAL. 1-11 includes manually hidden rows, while 101-111 excludes them; filtered-out cells are always excluded.|
|ref1||Required||This is the first named range, which will be used in the function.|
|ref2||Optional||We can use 2 to 254 ranges or references.|
This function returns any numeric value.
Microsoft Excel 365, Microsoft Excel 365 for Mac, Excel for the web Excel 2021, Excel 2021 for Mac, Excel 2019, Excel 2019 for Mac, Excel 2016, Excel 2016 for Mac, Excel 2013, Excel 2010, Excel 2007, Excel for Mac 2011, Excel Starter 2010.
Calculations Available with SUBTOTAL Function
The SUBTOTAL function can perform 11 different Excel operations or functions. These functions are specified in the function_num argument. It also offers two conditions for every function. One is including hidden and filtered data and the other is ignoring the hidden data. The available functions with their corresponding numbers are given below:
|Function||With Hidden Data||Without Hidden Data|
How to Use SUBTOTAL Function in Excel
Now, we show the use of the SUBTOTAL Function. For this, we consider a data set of clothing stores from two branches.
Apply SUBTOTAL from the Data Tab:
- First, sort the data in Column B.
- Go to the Data tab.
- Select Subtotal from the Outline command.
- Get the Subtotal dialog box.
- Select the column from the dropdown.
- Select the required function from the Use function.
- Now, choose the columns where the function will perform.
- Then, press OK.
Here, we apply the sum operation based on the product category. We also get some for each product and finally also get the sum for all the products.
- In the left upper corner, 1,2,3 numbers are shown.
- First, click on 1.
Here, we get only the Grand Total.
- Then, select 2.
We get the Grand Total including the total of each product separately.
- Finally, select 3.
Here, we get each product with details separately with the totals.
This method is applied when we want to perform the SUBTOTAL with a detailed operation. We can also simply use the formulas as per our requirements.
Apply SUBTOTAL by Inserting Formula:
- Go to Cell C17.
- Write the SUBTOTAL function.
- In the first argument, a dropdown will appear.
- Choose the required function or operation from the dropdown.
- Then select the data or range to apply the function.
- Here, our applied formula is:
- Now, press Enter.
Here, we performed the sum operation using the SUBTOTAL function.
3 Examples with Excel SUBTOTAL Function
Here, we will see different uses of the Excel SUBTOTAL Function.
1. Calculate the Average Using Excel SUBTOTAL Function
We will find the average inserting the SUBTOTAL function in this method.
- First, modify the data set to perform the average operation.
- Write the SUBTOTAL Function on Cell C17.
- We put 1 on the first argument, which indicates average.
- So, the formula becomes:
- Then press Enter.
Here, we get the average price by applying the SUBTOTAL function.
2. Count Operation in Excel by SUBTOTAL
In this section, we will show the count operation by the SUBTOTAL function. We can show the COUNT and COUNTA operations of Excel through this SUBTOTAL default function. The COUNT function counts only the numeric values. But COUNTA counts both numeric and alphabetic values.
- We modify the data before applying the operation.
- We apply the formulas in Cells C17 and C18 individually.
- Now, put the formula to perform the COUNT operation in Cell C17.
- Write the formula to perform the COUNTA operation in Cell C18.
- Then press Enter.
We can see the results here. In the formula 2 indicates COUNT and 3 indicates COUNTA operation.
- How to Use Excel EXP Function (5 Examples)
- Use ROUNDUP Function in Excel (6 Examples)
- How to Use ROUNDDOWN Function in Excel (5 Methods)
- Use SQRT function in Excel (6 Suitable Examples)
- How to Use COS Function in Excel (2 Examples)
3. Insert SUBTOTAL Function to Find Max/Min Value
In this section, we will apply the SUBTOTAL function to find out the maximum or minimum value.
- We mention two separate boxes to show the maximum and minimum values.
- Now, put the formula on Cell C17. The formula is:
- Here, 4 is indicating the maximum value.
- Now, press Enter.
- Again, write a formula on Cell C18 to get the minimum value. The formula is:
- Here, 5 is indicating the minimum value.
- Then press Enter.
Here, we get both the maximum and minimum values by using the SUBTOTAL function.
The SUM operation is already shown. We can also perform PRODUCT, Standard Deviation, and Variance operations through this SUBTOTAL function. Including all, we can perform 11 operations through this SUBTOTAL function.
Things to Remember
When we need to avoid the hidden or filtered object, we will use 101-111 in the first argument.
In this article, we described how to use the Excel SUBTOTAL function. I hope this will satisfy your needs. Please have a look at our website Exceldemy.com and give your suggestions in the comment box.
- SUMPRODUCT() function in Excel
- Exponential Notation E in Excel & How to Turn Off Auto Scientific Notation!
- Solving equations in Excel (polynomial, cubic, quadratic, & linear)
- How to Use INT Function in Excel (With 8 Examples)
- Use SUM Function in Excel (With 6 Easy Examples)
- How to Use RANDBETWEEN Function in Excel (4 Examples)