Lookup and referenceMicrosoft 365

PIVOTBY

Cross-tabulate measures using row groups and column groups in a spilling formula.

Syntax

=PIVOTBY(row_fields, col_fields, values, function, [field_headers], [row_total_depth], [row_sort_order], [col_total_depth], [col_sort_order], [filter_array], [relative_to])

Worked example

Cross-tabulate the four observations by team and quarter. Both total depths are zero to keep just the four combinations.

=PIVOTBY({"A";"A";"B";"B"},{"Q1";"Q2";"Q1";"Q2"},{5;7;2;3},SUM,0,0,,0)

Result Team A has 5 in Q1 and 7 in Q2. Team B has 2 in Q1 and 3 in Q2.

Microsoft documentation

Check the arguments, supported editions and behavior of this function in Microsoft’s reference.

Microsoft reference

Search ExcelTutor