Subtotal Function

The SUBTOTAL function can return an SUM, AVERAGE, COUNT, MAX, and other values, and it can include or exclude values from hidden rows.

Syntax =SUBTOTAL (function_num, ref1, [ref2], …)

Arguments 

  • function_num – A number that specifies which function to use in calculating subtotals within a list. See table below for full list.
  • ref1 – A named range or reference to subtotal.
  • ref2 – [optional] A named range or reference to subtotal.

The SUBTOTAL function in Excel returns an aggregate calculation based on the input values. SUBTOTAL, despite its name, is capable of a wide range of calculations, including SUM, AVERAGE, COUNT, MAX, MIN, and others listed in the table below.

FunctionInclude hiddenIgnore hiddenKnow more
AVERAGE1101Practice AVERAGE
COUNT2102Practice COUNT
COUNTA3103Practice COUNTA
MAX4104Practice MAX
MIN5105Practice MIN
PRODUCT6106Practice PRODUCT
STDEV7107Practice STDEV
STDEVP8108Practice STDEVP
SUM9109Practice SUM
VAR10110Practice VAR
VARP11111Practice VARP

The SUBTOTAL function can include or exclude values from hidden rows, making it particularly useful in Excel Tables and filtered data. SUBTOTAL by default ignores values in rows hidden by a filter. SUBTOTAL returns an aggregate result from a set of data, regardless of the calculation used.

To avoid double-counting, the SUBTOTAL function automatically ignores other SUBTOTAL formulas in references.

Examples

Below are  examples of SUBTOTAL configured to SUM, COUNT, and AVERAGE the values in a range. Notice the only difference is the value used for the function_num argument:

=SUBTOTAL(109,range) // SUM
=SUBTOTAL(103,range) // COUNT
=SUBTOTAL(101,range) // AVERAGE

In the worksheet shown above, the formulas in C4 and F4 are:

=SUBTOTAL(3,B7:B19) // count visible
=SUBTOTAL(9,F7:F19) // sum visible
=SUBTOTAL(3,B7:B19) // count visible
=SUBTOTAL(9,F7:F19) // sum visible

Note: SUBTOTAL always ignores values in cells that are hidden with a filter. Values in rows that have been “filtered out” are never included, regardless of function_num.

Practice subtotal function below:

The formula can be entered in the highlighted cell. If the formula entered is correct, it shows good job. If the formula is entered incorrectly, the result will be invalid. Please keep in mind that you can only enter formula in the highlighted cells.

Find the sum of total sales using subtotal function:

Hurray! You know now how to use subtotal function. Practice other functions by checking our articles below.

Are you looking for a full fledged training? You are at the right place.

At TechnoExcel :

You can upskill yourself with:

Why us?

Techno Excel is a leading provider of Excel courses and data analytics courses. We not only teach you how to use excel but also help customize it for your exact needs! Make the most out of your career with Techno Excel. Students can join via classroom course or via Online course. This is the place where students can easily learn the required skill set to get placed immediately

Learn data science and other technologies at your convenient time. We have a flexible schedule, which is designed to suit your learning style and pace. Whether you are a beginner or a professional looking for advanced techniques, we have the right course for you. Hurry up!! Book your seat now!!!

Class-room of your choice

Upskill yourself by attending classroom or online class.

Flexible timings

Learn at your convenient time. We have a flexible schedule, which is designed to suit your learning style and pace.

Class-Room Size

With limited students in class, attention to each student’s performance will be given.

Industry Ready Curriculum

The course is designed for people who want to work in the industry.

Book your free consultation now

If you want to improve your skills and get ready for the workforce! Please enter your information below, and one of our expertise will contact you shortly.

    Leave a Comment

    Your email address will not be published. Required fields are marked *