# SUBTOTAL Function

The SUBTOTAL function is one of the math and trigonometry functions. The function is used to return a subtotal in a list or database.

The SUBTOTAL function syntax is:

SUBTOTAL(function-number, argument-list)

where

function-number is a numeric value that specifies which function to use for the subtotal. The possible values are listed in the table below. For the function-number arguments 1 to 11, the SUBTOTAL function includes values of the rows that have been hidden manually. For the function-number arguments 101 to 111, the SUBTOTAL function ignores values of the rows that have been hidden manually. Values hidden by the filter are always excluded.

argument-list is a reference to the cell range containing the values for which you want the subtotal.

function-number (includes hidden values) | function-number (excludes hidden values) | 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

To apply the SUBTOTAL function,

1. select the cell where you wish to display the result,
2. click the Insert Function icon situated at the top toolbar,
   or right-click within a selected cell and select the Insert Function option from the menu,
   or click the icon situated at the formula bar,
3. select the Math and trigonometry function group from the list,
4. click the SUBTOTAL function,
5. enter the required arguments separating them by comma,
6. press the Enter button.

The result will be displayed in the selected cell.

The figure below displays the result returned by the SUBTOTAL function when several rows are hidden.