EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • Featured Skills
    • New & Trending
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign Up
Home Excel Excel Resources Maths Function in Excel SUBTOTAL in Excel
 

SUBTOTAL in Excel

Pradeep S
Article byPradeep S
Madhuri Thakur
Reviewed byMadhuri Thakur

Updated May 5, 2023

SUBTOTAL Function in Excel

 

 

Excel SUBTOTAL Function (Table of contents)

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

  • SUBTOTAL in Excel
  • SUBTOTAL Formula in Excel
  • How to Use SUBTOTAL Function in Excel?

SUBTOTAL in Excel

  • A subtotal function is an inbuilt function in Excel that is categorized under the math/trig function.
  • Subtotal will not just total the numbers in a defined range of cells; it will help out by performing different arithmetic operations.
  • SUBTOTAL is versatile. You can use it to average, sum up, count a bunch of cells & other calculations.

Definition

Returns a subtotal in a database or list, i.e., finding out the subtotal of a given range of cells. It performs a specified calculation for a given set of values.

SUBTOTAL Formula in Excel

The formula for the SUBTOTAL function is as follows:

SUBTOTAL Formula

SUBTOTAL(function_num, ref1, [ref2],…)Where

Function_num or operation code: It indicates which function should be used to calculate the subtotals within a given list. It is a type of mathematical operation that you like to perform.

A function_num argument is applied based on the below mentioned two criteria or methods.

  1. Include hidden values When the function_num argument is between 1-11, the SUBTOTAL function will include the hidden values.
  2. Ignore hidden values When the function_num argument is between 101-111, the SUBTOTAL function will exclude or ignore the hidden values. It will find values only invisible rows that ignore hidden values in the calculation.
Fun_num
Includes hidden values
Fun_num
Excludes hidden values
Function Description
1 101 AVERAGE It calculates the Average of a specified range.
2 102 COUNT It will Count the number of cells that contain numeric values.
3 103 CONTACT It will Count non-empty cells in the specified range.
4 104 MAX It will find out the largest value in the specified range.
5 105 MIN It will find out the smallest value in the specified range.
6 106 PRODUCT It calculates the product of cells in the specified range.
7 107 STDEV It estimates Standard Deviation in the specified range.
8 108 STDEVP It calculates Standard Deviation based on the entire population.
9 109 SUM It calculates the Sum of the specified range.
10 110 VAR It estimates variance in the specified range.
11 111 VARP It estimates variance based on the entire population.

ref1, [ref2]: One or more references to cells containing the values that the calculation is to be performed for subtotal.

How to Use the SUBTOTAL Function in Excel?

Let’s look at how the SUBTOTAL function works in Excel.

You can download this SUBTOTAL Function Excel Template here – SUBTOTAL Function Excel Template

Example #1 – SUBTOTAL Formula for values Hidden using Excel Autofilter or Rows Hidden by a filter

The table contains Quarterly Sales Data in the below-mentioned example, where individual quarters are in column E & sales data in column F.

Quarterly Sales Data

Sum function is applied in cell “F16” i.e. =SUM(F4:F15).

Sum function

It returns or results in a value of 1184.

SUBTOTAL Example 1-1

The SUM function returns the same value. i.e. 1184, instead of 194 for Q4 data, if rows are hidden by a filter (Below mentioned screenshot).

SUBTOTAL Example 1-3

If I want the Correct SUM value of Q4 data only, then I need to use the SUBTOTAL function.

Before applying the SUBTOTAL function, Under the data toolbar, apply a filter for the header row.

Let’s calculate specifically Q1 or Q2 or Q3 or Q4 sales data individually for filtered data.

Use 109 as a function_num argument in the SUBTOTAL function, to Sum up the data. i.e. =SUBTOTAL(109,C17:C28)

SUBTOTAL Example 1-4

The SUBTOTAL function ignores rows hidden by a filter and calculates the correct result.

Here subtotal value changes dynamically according to the filter; it will find a sum of values in visible rows only; the SUBTOTAL function neglects hidden rows. (Below mentioned, e.g.)

Q4

Result For Q4

Q3

Result For Q3

Q2

Result For Q2

Q1

Result For Q1

Example #2 – SUBTOTAL Function for manually Hidden Rows

In the Excel sheet, row no 15, 16, 19, and 20 have been hidden using the row formatting option by highlighting these rows, right-clicking with the mouse, and selecting Hide.

SUBTOTAL Function for manually Hidden Rows

A subtotal function is used in cell C23 of the spreadsheet to calculate the sum of visible cells.

SUBTOTAL Example 2-1

We have to Use 109 as a function_num argument in the SUBTOTAL function, to Sum up the data.

i.e. =SUBTOTAL(109,C14:C21)

SUBTOTAL function to Sum up the data

Here, the SUBTOTAL function ignores manually rows hidden and calculates the correct result.

SUBTOTAL Example 2-3

It will find a sum of values in visible rows only; the SUBTOTAL function neglects hidden rowsExample #3 – SUBTOTAL Function for normal value

As all of the cells in the range of quarterly sales figures are visible, none of them is filtered, or rows are hidden; it includes all the values.

SUBTOTAL Example 3

In the below-mentioned example, multiple subtotal functions are applied.

In a cell, C14, C15 & C16 SUBTOTAL function is applied.

SUBTOTAL function is applied

To calculate the SUM value, Function number 9 or 109 is used in a subtotal function where It calculates the Sum of a specified range, i.e. =SUBTOTAL (9, C4:C11)

SUBTOTAL Function

It will give us the sum of all values in C4:C11, provided none are filtered & rows are hidden in that specified range.

SUBTOTAL Example 3-3

To calculate the MIN value, Function number 5 or 105 is used in a subtotal function where It will find out the smallest value in the specified range. In a cell, C15, a SUBTOTAL function is applied, i.e. =SUBTOTAL(5,C4:C11)

SUBTOTAL function

It will find out the smallest value in the specified range, i.e. C4:C11

Smallest value

To calculate the MAX value, Function number 4 or 104 is used in a subtotal function where It will find out the largest value in the specified range. In a cell, C16, a SUBTOTAL function is applied, i.e. =SUBTOTAL(4,C4:C11)

SUBTOTAL function

It will find out the largest value in the specified range, i.e. C4:C11.

SUBTOTAL Example 3-7

Things to Remember about the SUBTOTAL Function

  • You can apply the SUBTOTAL function to find the sum of filtered values.
  • A SUBTOTAL function is used to ignore values in hidden rows.
  • Function _ num argument value should not be greater than 11 or less than 1, and similarly should not be greater than 111 or less than 101; otherwise, it will give #VALUE! error.
  • A SUBTOTAL function is applicable only for the numeric value.
  • If there are any subtotals present in the SUBTOTAL range, they will be neglected, i.e. If any already existing SUBTOTAL formulas are present in the input range of another SUBTOTAL formula, then these values are neglected by subtotal function during the calculation so that double counting is avoided & it prevents the error of double counting.
  • You can use a SUBTOTAL function to dynamically summarize data in Excel.
  • The subtotal function ignores blank cells and cells containing non-numeric values when calculating data.

Recommended Articles

This has been a guide to SUBTOTAL. Here we discuss the SUBTOTAL Formula and how to use the SUBTOTAL Function along with excel examples and downloadable excel templates. You may also look at these useful functions in Excel –

  1. FIND Function in Excel
  2. NOT in Excel
  3. TRANSPOSE in Excel
  4. VBA SUB

Primary Sidebar

Footer

Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA

Download SUBTOTAL Function Excel Template

EDUCBA Login

Forgot Password?

EDUCBA

Download SUBTOTAL Function Excel Template

EDUCBA

डाउनलोड SUBTOTAL Function Excel Template

🚀 Limited Time Offer! - 🎁 ENROLL NOW