Skip to main content
added 4 characters in body
Source Link
Tedinoz
  • 5.8k
  • 2
  • 13
  • 31

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, and label 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, and label 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.

Example output

Screenshot

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, and label 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.

Example output

Screenshot

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, and label 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.

Example output

Screenshot

Source Link
Tedinoz
  • 5.8k
  • 2
  • 13
  • 31

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, and label 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.

Example output

Screenshot