Ravindra BagaleCourses & study guides Track your progress

Excel SUBTOTAL Function

Chala mitrano — today SUBTOTAL. Totals that respect AutoFilter — function 9 is SUM; use 109 to ignore hidden rows too.

Fictional sample data for learning. Filtered sales in Ahmedabad showrooms and Boston outlets. Mixed ₹ and $.

Purpose

Run a stats function (SUM, COUNT, AVERAGE, …) on a range, with options that respect filters.

Return value

The subtotal result for the chosen function_num.

Syntax

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

Arguments

ArgumentRequired?Description
function_numRequiredCode for the job: 1 AVERAGE, 2 COUNT, 3 COUNTA, 9 SUM, …; 101+ ignore hidden rows.
ref1RequiredRange to aggregate.
ref2,…OptionalMore ranges.

Version

Excel 2003+. LibreOffice Calc too.

How to use — Why → What → How

Why: Filtered sheets still show a correct total. SUBTOTAL is the classic filter-friendly total. Filtered sales in Ahmedabad showrooms and Boston outlets. Mixed ₹ and $. In Indian back offices and foreign sister teams, SUBTOTAL shows up on totals, rates and pack sheets every week.

What: SUBTOTAL applies a built-in function coded by function_num. Codes 1–11 include manually hidden rows; 101–111 ignore hidden rows. Filtered-out rows are skipped for both families in normal AutoFilter use. Read every argument in the table once before you type; each one changes the answer on purpose.

How — numbered steps:

  1. Type =SUBTOTAL(9,B2:B100) for SUM.
  2. Prefer 109 when you hide rows manually too.
  3. Do not nest SUBTOTAL ranges carelessly — Excel skips other SUBTOTAL cells.

Ravindra Bagale's Tip

Friends, after SUBTOTAL, find one column or range in a real workbook this week where this lesson saves time.

Ravindra Bagale's Tip

Friends, sleep on SUBTOTAL; rebuild example 1 tomorrow without looking.

Ravindra Bagale's Tip

Friends, say the business question in plain words before =SUBTOTAL.

Ravindra Bagale's Tip

Friends, check a known case with a calculator before you trust a long SUBTOTAL chain.

Ravindra Bagale's Tip

Friends, after you finish SUBTOTAL, open yesterday’s real workbook and find one place this function would have saved ten minutes.

Ravindra Bagale's Tip

Friends, treat SUBTOTAL like a seatbelt on number columns — check a known case first.

Download practice file: practice-subtotal.xlsx (includes sheet About this data, practice sheets, and Answers).

Worked examples

1) SUM code 9

Ahmedabad.

₹
10
20
30
Formula: =SUBTOTAL(9,A2:A4)

Result: 60

What it means: Same as SUM when nothing is filtered.

2) AVERAGE code 1

Mean.

₹
10
20
30
Formula: =SUBTOTAL(1,A2:A4)

Result: 20

What it means: Average of three.

3) COUNT code 2

Numbers only.

Val
10
x
30
Formula: =SUBTOTAL(2,A2:A4)

Result: 2

What it means: Two numbers.

4) Boston $

Visible SUM habit.

$
5
15
25
Formula: =SUBTOTAL(109,A2:A4)

Result: 45

What it means: 109 = SUM ignoring hidden rows.

5) vs SUM reminder

Filter story.

City₹
Pune10
Test99
Surat20
Formula: =SUBTOTAL(9,B2:B4)

Result: 129

What it means: Without filter equals SUM; with City filter, only visible ₹ add.

6) COUNTA code 3

Non-blanks.

Name
Asha
None
Ben
Formula: =SUBTOTAL(3,A2:A4)

Result: 2

What it means: Two names.

Common errors and fixes

#VALUE! — Bad function_num. Fix: Use documented codes 1–11 or 101–111.
Wrong total with manual hide — Used 9 instead of 109. Fix: Pick 101–111 family.
Nested surprise — SUBTOTAL skips other SUBTOTAL results. Fix: Design layout carefully.

Notes and tips

  • Revisit the SUBTOTAL errors table after the quiz.
  • Build example 1 from memory on a blank sheet.
  • Check number vs text if a result looks wrong.
  • Teach one tip in Marathi or Hindi this week.
  • Keep currency symbols consistent inside one report column (practice mixes ₹ $ £ €).
  • Drill: filtered City total with SUBTOTAL 9 from memory; also try 109.
  • SUBTOTAL vs SUM: filter-aware versus always-all-rows.
  • Fictional sample data only — names and amounts are for learning.
  • Print the SUBTOTAL revision card for one week of real worksheets.
  • Ask juniors to predict before they press Enter.
  • Track your top mistake with this function monthly.
  • Filtered sales in Ahmedabad showrooms and Boston outlets. Mixed ₹ and $.
  • Interview tip: explain the business question before the formula.
  • Classroom drill: invent three brand-new formulas from your city without the page open.
  • If a result looks wrong, check blanks vs zeros before rewriting.
  • When Excel versions differ, note the LibreOffice / Sheets fallback in a cell comment.
  • Prefer clear ranges over whole-column refs on huge sheets if speed matters.
  • Document units (₹, kg, days) in the header so totals stay honest.
  • Print the revision card for SUBTOTAL for one week of real worksheets.
  • When helping a junior, ask them to predict before Enter.
  • Share one tip with a classmate in Marathi or Hindi.
  • Keep currency symbols consistent inside a single report column.
  • Interview tip: explain the business question before the formula.
  • If a result looks wrong, check blanks vs zeros before rewriting maths.
  • When Excel versions differ, write a LibreOffice fallback under a comment.

In real work

Drill: filtered City total with SUBTOTAL 9 from memory; also try 109. Filtered sales in Ahmedabad showrooms and Boston outlets. Mixed ₹ and $. Classroom drill: write three brand-new SUBTOTAL formulas on a blank sheet using names from your own city — if you can invent them without the page open, you own the skill. Then break one formula on purpose and watch the error; recovering from that break is half of interview readiness. Always verify with a known case before trusting a long chain. Keep a personal notebook of the one mistake you make most often with this function; review it monthly.

How it compares

SUBTOTAL vs SUM: filter-aware versus always-all-rows.

Interview corner

9 vs 109?
SUM vs SUM ignore hidden.
Filter?
SUBTOTAL skips filtered-out.
vs AGGREGATE?
AGGREGATE has more options.

AGGREGATE, SUM, AVERAGE, COUNT

Practice tasks (10)

  1. Task 1. SUBTOTAL 9 SUM.
    9.
  2. Task 2. AVERAGE code 1.
    1.
  3. Task 3. COUNT code 2.
    2.
  4. Task 4. 109 vs 9 explain.
    Interview.
  5. Task 5. Filter a city and watch total.
    Filter.
  6. Task 6. Fill.
    Fill.
  7. Task 7. Doc codes.
    Note.
  8. Task 8. Teach.
    Teach.
  9. Task 9. COUNTA 3.
    3.
  10. Task 10. Bonus AGGREGATE.
    Related.

Quick quiz

Q1. function_num 9 means?
Q2. 109 means?
Q3. Why not plain SUM on filters?
Q4. AVERAGE code?
Q5. Modern cousin?

Answers: Q1=SUM, Q2=SUM ignore hidden, Q3=Includes hidden/filtered wrongly for reports, Q4=1, Q5=AGGREGATE (check after you try).

Revision card

Standalone card (no tip or photo strip). QR opens this lesson. Download the PNG and revise offline.

Revision card: SUBTOTAL
SUBTOTAL revision card