Try this query:
={Transpose(query(A3:B46,"SELECT count(A) GROUP BY B label count(A) 'Total'"));query(A3:B46,"SELECT A, count(A) GROUP BY A PIVOT B")}
The formula consists of two queries:
Transpose(query(A3:B46,"SELECT count(A) GROUP BY B label count(A) 'Total'"))
- this counts the number of "Floor" items for each "Type".
- Note inclusion of
transpose
to get the output to appear on a single row, andlabel count(A) 'Total'
to generate an appropriate label for the row.- this counts the number of "Floor" items for each "Type".
- Note inclusion of
transpose
to get the output to appear on a single row, andlabel count(A) 'Total'
to generate an appropriate label for the row.
query(A3:B46,"SELECT A, count(A) GROUP BY A PIVOT B")
- this uses the
PIVOT
clause.
- this uses the
Example output