<p>The <b>AGGREGATE</b> function is one of the math and trigonometry functions. The function is used to return an aggregate in a list or database. The <b>AGGREGATE</b> function can apply different aggregate functions to a list or database with the option to ignore hidden rows and error values.</p>
<pstyle="text-indent: 50px;"><b><em>function_num</em></b> is a numeric value that specifies which function to use. The possible values are listed in the table below.</p>
<pstyle="text-indent: 50px;"><b><em>options</em></b> is a numeric value that specifies which values should be ignored. The possible values are listed in the table below.</p>
<tablestyle="width: 40%">
<tr>
<td><b>Numeric value<br/></b></td>
<td><b>Behavior</b></td>
</tr>
<tr>
<td>0 or omitted</td>
<td>Ignore nested <ahref="../Functions/subtotal.htm"onclick="onhyperlinkclick(this)">SUBTOTAL</a> and AGGREGATE functions</td>
</tr>
<tr>
<td>1</td>
<td>Ignore hidden rows, nested <ahref="../Functions/subtotal.htm"onclick="onhyperlinkclick(this)">SUBTOTAL</a> and AGGREGATE functions</td>
</tr>
<tr>
<td>2</td>
<td>Ignore error values, nested <ahref="../Functions/subtotal.htm"onclick="onhyperlinkclick(this)">SUBTOTAL</a> and AGGREGATE functions</td>
</tr>
<tr>
<td>3</td>
<td>Ignore hidden rows, error values, nested <ahref="../Functions/subtotal.htm"onclick="onhyperlinkclick(this)">SUBTOTAL</a> and AGGREGATE functions</td>
</tr>
<tr>
<td>4</td>
<td>Ignore nothing</td>
</tr>
<tr>
<td>5</td>
<td>Ignore hidden rows</td>
</tr>
<tr>
<td>6</td>
<td>Ignore error values</td>
</tr>
<tr>
<td>7</td>
<td>Ignore hidden rows and error values</td>
</tr>
</table>
<pstyle="text-indent: 50px;"><b><em>ref1(2)</em></b> is up to 253 numeric values or a reference to the cell range containing the values for which you want the aggregate value.</p>
<pclass="note"><b>Note:</b> if you want to use one of the following functions: <ahref="../Functions/large.htm"onclick="onhyperlinkclick(this)">LARGE</a>, <ahref="../Functions/small.htm"onclick="onhyperlinkclick(this)">SMALL</a>, <ahref="../Functions/percentile-inc.htm"onclick="onhyperlinkclick(this)">PERCENTILE.INC</a>, <ahref="../Functions/quartile-inc.htm"onclick="onhyperlinkclick(this)">QUARTILE.INC</a>, <ahref="../Functions/percentile-exc.htm"onclick="onhyperlinkclick(this)">PERCENTILE.EXC</a>, or <ahref="../Functions/quartile-exc.htm"onclick="onhyperlinkclick(this)">QUARTILE.EXC</a>, <b><em>ref1</em></b> must be a reference to the cell range and <b><em>ref2</em></b> must be the second argument that is required for these functions (<b><em>k</em></b> or <b><em>quart</em></b>).</p>
<p>The figure below displays the result returned by the <b>AGGREGATE</b> function when the <b>LARGE</b> function is applied, <b><em>ref1</em></b> is a reference to the cell range, and <b><em>k</em></b> is equal to 2. The function returns the second largest value in cells A1-A4.</p>