How can I use the SUBTOTAL function in Excel to calculate totals and subtotals for a range of data?

How can I use the SUBTOTAL function in Excel to calculate totals and subtotals for a range of data?

The SUBTOTAL function in Excel is a useful tool for calculating totals and subtotals for a range of data. This function allows users to easily sum up data in a selected range, while also excluding any hidden rows or filtered data. By using this function, users can quickly and accurately calculate the total and subtotal amounts for their data, making it a valuable tool for data analysis and organization. The SUBTOTAL function can be applied to a variety of data, including numerical, text, and date values, making it a versatile tool for various types of data sets. Overall, the SUBTOTAL function in Excel is an efficient and reliable method for calculating totals and subtotals, making it an essential tool for data management and analysis.

This article describes the formula syntax and usage of the SUBTOTAL function in Microsoft Excel.

Description

Returns a subtotal in a list or database. It is generally easier to create a list with subtotals by using the Subtotal command in the Outline group on the Data tab in the Excel desktop application. Once the subtotal list is created, you can modify it by editing the SUBTOTAL function.

Syntax

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

The SUBTOTAL function syntax has the following arguments:

  • Function_num     Required. The number 1-11 or 101-111 that specifies the function to use for the subtotal. 1-11 includes manually-hidden rows, while 101-111 excludes them; filtered-out cells are always excluded.

Function_num
(includes hidden rows)

Function_num
(ignores hidden rows)

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

  • Ref1     Required. The first named range or reference for which you want the subtotal.

  • Ref2,…     Optional. Named ranges or references 2 to 254 for which you want the subtotal.

Remarks

  • If there are other subtotals within ref1, ref2,… (or nested subtotals), these nested subtotals are ignored to avoid double counting.

  • For the function_num constants from 1 to 11, the SUBTOTAL function includes the values of rows hidden by the Hide Rows command under the Hide & Unhide submenu of the Format command in the Cells group on the Home tab in the Excel desktop application. Use these constants when you want to subtotal hidden and nonhidden numbers in a list. For the function_Num constants from 101 to 111, the SUBTOTAL function ignores values of rows hidden by the Hide Rows command. Use these constants when you want to subtotal only nonhidden numbers in a list.

  • The SUBTOTAL function ignores any rows that are not included in the result of a filter, no matter which function_num value you use.

  • The SUBTOTAL function is designed for columns of data, or vertical ranges. It is not designed for rows of data, or horizontal ranges. For example, when you subtotal a horizontal range using a function_num of 101 or greater, such as SUBTOTAL(109,B2:G2), hiding a column does not affect the subtotal. But, hiding a row in a subtotal of a vertical range does affect the subtotal.

  • If any of the references are 3-D references, SUBTOTAL returns the #VALUE! error value.

Cite this article

stats writer (2024). How can I use the SUBTOTAL function in Excel to calculate totals and subtotals for a range of data?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-the-subtotal-function-in-excel-to-calculate-totals-and-subtotals-for-a-range-of-data/

stats writer. "How can I use the SUBTOTAL function in Excel to calculate totals and subtotals for a range of data?." PSYCHOLOGICAL SCALES, 1 Jul. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-the-subtotal-function-in-excel-to-calculate-totals-and-subtotals-for-a-range-of-data/.

stats writer. "How can I use the SUBTOTAL function in Excel to calculate totals and subtotals for a range of data?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-the-subtotal-function-in-excel-to-calculate-totals-and-subtotals-for-a-range-of-data/.

stats writer (2024) 'How can I use the SUBTOTAL function in Excel to calculate totals and subtotals for a range of data?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-the-subtotal-function-in-excel-to-calculate-totals-and-subtotals-for-a-range-of-data/.

[1] stats writer, "How can I use the SUBTOTAL function in Excel to calculate totals and subtotals for a range of data?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, July, 2024.

stats writer. How can I use the SUBTOTAL function in Excel to calculate totals and subtotals for a range of data?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top