SUBTOTAL Function in Excel

If you’re working with Excel tables and want to calculate totals that adjust automatically when filters are applied, the SUBTOTAL function is the perfect tool. In this guide, we’ll show how to use it effectively with data like Region, Salesperson, Category, Revenue $, and Units.

📊 Sample Data Table

RegionSalespersonCategoryRevenue $Units
NorthAmanElectronics500025
SouthRiyaApparel300018
EastDevElectronics450020
WestPoojaGrocery250015
NorthSureshApparel320017

🔧 Step-by-Step: Use SUBTOTAL to Get Dynamic Totals

Let’s say you’ve applied filters on Region or Category, and you want Excel to calculate totals only for visible rows.

➤ Total Revenue (Visible Rows Only):

=SUBTOTAL(9, D2:D6)

Explanation:
  • 9 is the function number for SUM
  • D2:D6 is the Revenue $ column

➤ Total Units (Visible Rows Only):

=SUBTOTAL(9, E2:E6)

This will automatically recalculate based on the filtered data.

🔢 Common SUBTOTAL Function Numbers

FunctionIncludes Hidden RowsIgnores Hidden Rows
SUM9109
AVERAGE1101
COUNT2102
MAX4104
MIN5105

For filtered tables, always use numbers from 101–111 to ignore hidden rows manually.

✅ Why Use SUBTOTAL?

  • Dynamic results when filtering data
  • Avoids manual updates to formulas
  • Works great with Excel Tables and Dashboards
  • Helps in cleaner, interactive reporting

💡 Bonus Tip: Use AutoSum with Filtered Data

  1. Apply filters on your table.
  2. Click on the AutoSum button in the ribbon.
  3. Excel automatically uses the SUBTOTAL formula (instead of SUM) for filtered data.

🧠 Final Words

Using the SUBTOTAL function in Excel is a must-know trick for anyone working with filtered datasets like Region-wise sales reports or category-based revenue. It keeps your totals dynamic and smart—saving you time and reducing errors.

Example:

Leave a Reply

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

Pinterest
Instagram