GROUPBY
groups rows by a field and aggregates values — excel's argument list; `function` takes an aggregation NAME or selector, not a function reference · from excel · excel: differs in detail · no sheets equivalent
signature
GROUPBY(row_fields, values, function, [field_headers], [total_depth], [sort_order], [filter_array], [field_relationship])
returns: array
| argument | required |
|---|---|
| row_fields | required |
| values | required |
| function | required |
| field_headers | optional |
| total_depth | optional |
| sort_order | optional |
| filter_array | optional |
| field_relationship | optional |
examples
formula and result, taken from the engine's own test suite — every result below is asserted in CI, not written by hand.
| R | S | |
|---|---|---|
| 2 | north | 100 |
| 3 | south | 200 |
| 4 | north | 300 |
fx
=GROUPBY(R2:R4, S2:S4, 1) north fx
=GROUPBY(R2:R4, S2:S4, 3) north errors
error values observed from the engine — each with a call that produces it.
| error | produced by |
|---|---|
| #VALUE! | =GROUPBY(1, A1:A3, 3) |
related
- DAVERAGE average of database values matching criteria
- DCOUNT counts numeric database values matching criteria
- DCOUNTA counts non-empty database values matching criteria
- DGET the single database value matching criteria
- DMAX largest database value matching criteria
- DMIN smallest database value matching criteria