# SUBTOTAL

## Content

This function calculates a subtotal of a list of numbers using a specified built-in function.

## Syntax

`SUBTOTAL(functioncode, value1, value2,...)`

`SUBTOTAL(functioncode, array)`

## Arguments

The *functioncode* argument is the number that represents the built-in function to use for the subtotal, as given in this table.

| Built-In Function | Function Code (Include Hidden Values) | Function Code (Ignore Hidden Values) |
| ----------------- | ------------------------------------- | ------------------------------------ |
| [AVERAGE](/spreadjs/docs/v17/formulareference/FormulaFunctions/statistical-functions/AVERAGE) | 1 | 101 |
| [COUNT](/spreadjs/docs/v17/formulareference/FormulaFunctions/statistical-functions/COUNT) | 2 | 102 |
| [COUNTA](/spreadjs/docs/v17/formulareference/FormulaFunctions/statistical-functions/COUNTA) | 3 | 103 |
| [MAX](/spreadjs/docs/v17/formulareference/FormulaFunctions/statistical-functions/MAX) | 4 | 104 |
| [MIN](/spreadjs/docs/v17/formulareference/FormulaFunctions/statistical-functions/MIN) | 5 | 105 |
| [PRODUCT](/spreadjs/docs/v17/formulareference/FormulaFunctions/math-trig-functions/PRODUCT) | 6 | 106 |
| [STDEV](/spreadjs/docs/v17/formulareference/FormulaFunctions/compatibility-functions/STDEV) | 7 | 107 |
| [STDEVP](/spreadjs/docs/v17/formulareference/FormulaFunctions/compatibility-functions/STDEVP) | 8 | 108 |
| [SUM](/spreadjs/docs/v17/formulareference/FormulaFunctions/math-trig-functions/SUM) | 9 | 109 |
| [VAR](/spreadjs/docs/v17/formulareference/FormulaFunctions/compatibility-functions/VAR) | 10 | 110 |
| [VARP](/spreadjs/docs/v17/formulareference/FormulaFunctions/compatibility-functions/VARP) | 11 | 111 |

Each additional argument can be a double-precision floating-point value, an integer value, or an array (cell range) of these. Up to 255 arguments can be included. You can use a single array (cell range) instead of a list of values. You can use multiple arrays (cell ranges) as well.

## Remarks

The SUBTOTAL function does not include other SUBTOTAL formula results that are in the same range. Setting the row height to zero also hides the values.

## Data Types

Accepts numeric data for all arguments. Returns numeric data.

## Examples

`SUBTOTAL(8,A1:B7)`