The SUBTOTAL function in Excel offers numerous beneficial features, such as the ability to: Calculate SUM, AVERAGE, COUNT, COUNTA, MAX, or MIN from your data. Include hidden values in your calculations by using the first argument function_num with values between 1-11. Exclude hidden values from your calculations by using the first argument function_num with values between 101-111. Calculate the SUBTOTAL of filtered values. Additionally, it can ignore other SUBTOTALS within your range to prevent double counting.
Key Takeaways
-
Calculate Only Visible Data – The
SUBTOTAL
function computes values for visible rows, ensuring no double-counting in filtered lists. -
Supports Various Operations –
SUBTOTAL
can execute functions like SUM, AVERAGE, COUNT, and others, using different function numbers. -
Adapts to Filtering – Unlike
SUM
,SUBTOTAL
dynamically updates when filters are applied, making it perfect for dynamic reports. - Excludes Hidden Rows – By using function numbers 101–111, you can ignore both manually hidden and filtered rows.
-
Ideal for Nested Subtotals – In Pivot Tables or structured reports,
SUBTOTAL
avoids repeating cumulative totals in groupings.
Table of Contents
Quick Overview
What does it do?
It calculates a Subtotal in a list or database.
Formula breakdown:
=SUBTOTAL(function_num, ref1)
What it means:
=SUBTOTAL(function number 1-11 includes manually-hidden rows & 101-111 excludes them, your list or range of data)
**Go to the bottom of this post to see what each value represents
PREVENTING DOUBLE COUNTING WITH THE SUBTOTAL FUNCTION…
This feature is likely the most valuable aspect of the SUBTOTAL function!
Imagine you have multiple SUBTOTALS within your dataset, one to Sum the North Region and another to Sum the South Region.
You can then add a third SUBTOTAL for your Grand Total that encompasses all your data while ignoring the North & South Region SUBTOTALS, thus ensuring no double counting in your Grand Total.
See the below images to understand how this works with the SUBTOTAL function and how it leads to double counting when using the SUM function:
*Values for the SUBTOTAL function_num:
**Includes hidden values** | **Ignores hidden values** | **Function** |
1 | 101 | AVERAGE |
2 | 102 | COUNT |
3 | 103 | COUNTA |
4 | 104 | MAX |
5 | 105 | MIN |
6 | 106 | PRODUCT |
7 | 107 | STDEV |
8 | 108 | STDEVP |
9 | 109 | SUM |
10 | 110 | VAR |
11 | 111 | VARP |
Frequently Asked Questions
What is the purpose of the SUBTOTAL function in Excel?
It calculates functions such as SUM, AVERAGE, COUNT, etc., but only on visible (non-filtered) data, helping you avoid including hidden rows in your calculations.
How does SUBTOTAL differ from SUM?SUM
calculates all values, whereas SUBTOTAL
can exclude hidden or filtered-out rows based on the function number used.
Which function number should I use to omit both filtered and hidden rows?
Use function numbers from 101 to 111 (e.g., 109 for SUM) to exclude both manually hidden and filtered rows.
Can SUBTOTAL be used in Pivot Tables?
While Pivot Tables have their own subtotal settings, SUBTOTAL
is beneficial in regular tables or data lists that use filters.
Why is SUBTOTAL more suitable for dynamic reports?
It automatically adjusts when you apply filters, providing accurate summaries without the need for manual adjustments.
The above is the detailed content of Excel Subtotal Function – Avoid Double Counting. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Quick LinksRecalculating Formulas in Manual Calculation ModeDebugging Complex FormulasMinimizing the Excel WindowMicrosoft Excel has so many keyboard shortcuts that it can sometimes be difficult to remember the most useful. One of the most overlooked

Quick Links Copy, Move, and Link Cell Elements

Quick Links Let Copilot Determine Which Table to Manipu

1. Check the automatic recovery folder, open "Recover Unsaved Documents" in Word or enter the C:\Users\Users\Username\AppData\Roaming\Microsoft\Word path to find the .asd ending file; 2. Find temporary files or use OneDrive historical version, enter ~$ file name.docx in the original directory to see if it exists or log in to OneDrive to view the version history; 3. Use Windows' "Previous Versions" function or third-party tools such as Recuva and EaseUS to scan and restore and completely delete files. The above methods can improve the recovery success rate, but you need to operate as soon as possible and avoid writing new data. Automatic saving, regular saving or cloud use should be enabled

Grouping by month in Excel Pivot Table requires you to make sure that the date is formatted correctly, then insert the Pivot Table and add the date field, and finally right-click the group to select "Month" aggregation. If you encounter problems, check whether it is a standard date format and the data range are reasonable, and adjust the number format to correctly display the month.

Microsoft Teams is not complicated to use, you can get started by mastering the basic operations. To create a team, you can click the "Team" tab → "Join or Create Team" → "Create Team", fill in the information and invite members; when you receive an invitation, click the link to join. To create a new team, you can choose to be public or private. To exit the team, you can right-click to select "Leave Team". Daily communication can be initiated on the "Chat" tab, click the phone icon to make voice or video calls, and the meeting can be initiated through the "Conference" button on the chat interface. The channel is used for classified discussions, supports file upload, multi-person collaboration and version control. It is recommended to place important information in the channel file tab for reference.

MicrosoftTeamsusesalotofmemoryprimarilybecauseitisbuiltonElectron,whichrunsmultipleChromium-basedprocessesfordifferentfeatureslikechat,videocalls,andbackgroundsyncing.1.Eachfunctionoperateslikeaseparatebrowsertab,increasingRAMusage.2.Videocallswithef

Quick Links Check the File's AutoSave Status
