SUBTOTAL function: Calculates the sum of the values ​​in a filtered list in Excel.

The function for calculating sums when filtering data is very important for Microsoft Excel users. This article will summarize how to filter and calculate sums in Excel using Subtotal.

The function to calculate sums when filtering data is very important for Microsoft Excel users . This article will summarize how to filter and calculate sums in Excel using subtotal.

 

While knowing how to sum a spreadsheet column is helpful, you might want to know the sum of different groups. The subtotal function in Excel is a practical way to calculate smaller amounts, separate from the final total. It's relatively easy to use in spreadsheets, and it also allows you to sort your data.

The subtotal function in Excel is a formula that calculates a range of values ​​based on a specified operation. It appears as =SUBTOTAL(function_num, ref1, [ref2],.), where function_num refers to the operation you want the formula to perform, and ref1, [ref2],. are the values ​​you want Excel to include in the calculation. One of the most common uses of the subtotal function is to sum a column, but it can also perform the following operations:

  • Medium
  • Count
  • Count them all
  • The greatest value
  • Minimum value
  • Multiplier
  • Population standard deviation
  • Standard deviation of the sample
  • Population variance
  • Sample variance

 

This tutorial is based on Excel 2019; however, you can still apply this calculation method to other versions of Excel such as Excel 2007, Excel 2010, Excel 2013, and Excel 2016, as it uses the Excel Subtotal function.

Calculate the total value of a filtered list using the Subtotal function in Excel.

Let's assume we have a data table like this, with the filter already created.

No. Product type Product name Quantity Unit price Total amount
1 Book Math exercises for 3rd grade 2 10000 20000
2 Pencil case TL Fabric Pencil Case 2 30000 60000
3 Pencil TL pencil 5 15000 75000
4 Book 3rd grade math 3 18000 54000
5 Book English for 3rd grade 3 19000 57000

After filtering the list of products that belong to the book category, we have the following spreadsheet:

The requirement is to calculate the total price of the books. If you use the SUM() function on the filtered data table above, the result you get will not be the total price of the books, but the total price of all products.

In this case, we use the SUBTOTAL function as follows; in cell E13, you enter:

=SUBTOTAL(9,H7:H11)

In this case, 9 is the argument value corresponding to the function to be used. Here, we want to calculate the sum, so the function to use is SUM. You can see it in the table below. H7:H11 is the range to be summed.

 

The result returned a total cost of books of 131,000.

Regarding the SUBTOTAL() function

The SUBTOTAL() function will examine the entire list of values ​​in column D and only calculate those values ​​that satisfy the filter. You can look at the image above and guess that this is because we declared argument 9. However, this argument tells Excel that we want to calculate the SUM of the referenced values. The following table lists the accepted arguments:

Including implicit value Ignore hidden values Jaw
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()

After reviewing the table above, you might be wondering about the difference between 9 and 109. When using the argument 9, the SUBTOTAL() function will sum all hidden values. However, when using the argument 109, the SUBTOTAL() function will ignore hidden values. We need to clearly distinguish between hidden values ​​and values ​​that are excluded because they don't meet the filter criteria . Hiding a row can be done by right-clicking on the row number and selecting Hide . This is completely different from rows that are not displayed because they don't meet the filter criteria.

The SUBTOTAL() function is also used to perform many other useful tasks; you can find more information in TipsMake.com's tutorial on the SUBTOTAL function .

See more:

  • How to use the Power function in Excel
  • How to use the Round function in Excel
  • How to use the Vlookup function in Excel
Related posts
Other Program articles
Category

System

Windows XP

Windows Server 2012

Windows 8

Windows 7

Windows 10

Wifi tips

Virus Removal - Spyware

Speed ​​up the computer

Server

Security solution

Mail Server

LAN - WAN

Ghost - Install Win

Fix computer error

Configure Router Switch

Computer wallpaper

Computer security

Mac OS X

Mac OS System software

Mac OS Security

Mac OS Office application

Mac OS Email Management

Mac OS Data - File

Mac hardware

Hardware

USB - Flash Drive

Speaker headset

Printer

PC hardware

Network equipment

Laptop hardware

Computer components

Advice Computer

Game

PC game

Online game

Mobile Game

Pokemon GO

information

Technology story

Technology comments

Quiz technology

New technology

British talent technology

Attack the network

Artificial intelligence

Technology

Smart watches

Raspberry Pi

Linux

Camera

Basic knowledge

Banking services

SEO tips

Science

Strange story

Space Science

Scientific invention

Science Story

Science photo

Science and technology

Medicine

Health Care

Fun science

Environment

Discover science

Discover nature

Archeology

Life

Travel Experience

Tips

Raise up child

Make up

Life skills

Home Care

Entertainment

DIY Handmade

Cuisine

Christmas

Application

Web Email

Website - Blog

Web browser

Support Download - Upload

Software conversion

Social Network

Simulator software

Online payment

Office information

Music Software

Map and Positioning

Installation - Uninstall

Graphic design

Free - Discount

Email reader

Edit video

Edit photo

Compress and Decompress

Chat, Text, Call

Archive - Share

Electric

Water heater

Washing machine

Television

Machine tool

Fridge

Fans

Air conditioning

Program

Unix and Linux

SQL Server

SQL

Python

Programming C

PHP

NodeJS

MongoDB

jQuery

JavaScript

HTTP

HTML

Git

Database

Data structure and algorithm

CSS and CSS3

C ++

C #

AngularJS

Mobile

Wallpapers and Ringtones

Tricks application

Take and process photos

Storage - Sync

Security and Virus Removal

Personalized

Online Social Network

Map

Manage and edit Video

Data

Chat - Call - Text

Browser and Add-on

Basic setup