Using AGGREGATE to Ignore Hidden Rows in LibreOffice Calc

The AGGREGATE function in LibreOffice Calc allows you to perform various mathematical and statistical calculations while ignoring hidden rows, error values, or nested subtotal functions. This guide explains how to construct an AGGREGATE formula specifically tailored to exclude rows hidden either manually or by using an AutoFilter.


The AGGREGATE Function Syntax

The standard syntax for the AGGREGATE function is:

AGGREGATE(Function_Index; Option; Reference_1; [Reference_2]; ...)


Key Options to Ignore Hidden Rows

To make AGGREGATE ignore hidden rows, choose the appropriate Option code:


Step-by-Step Examples

1. Summing Visible Rows

To calculate the total sum of visible cells in the range A2:A20 while ignoring rows that are hidden:

=AGGREGATE(9; 5; A2:A20)

2. Averaging Visible Rows While Ignoring Errors

If your range contains potential error values (like #N/A or #DIV/0!) alongside hidden rows, use option 7 to ignore both:

=AGGREGATE(1; 7; B2:B50)

3. Finding the Maximum Value in Visible Data

To retrieve the largest visible value in range C2:C30:

=AGGREGATE(4; 5; C2:C30)


Common Function Index Codes Reference

Code Operation
1 AVERAGE
2 COUNT
3 COUNTA
4 MAX
5 MIN
6 PRODUCT
7 STDEV.S
9 SUM
14 LARGE
15 SMALL