有什么方法可以仅使用公式在 Google 工作表中生成数据透视表 table 吗?

Is there any way to generate a pivot table in Google Sheets using only formulas?

我在没有实际使用 'Pivot table' 工具的情况下在 Google 工作表中生成枢轴 table 的任务卡住了。

使用原始数据导出文件:

目标是根据此导出文件生成 sheet,其中所有任务将按项目分组,并计算每个项目的总时间。

我的目标是:

问题是项目和任务的数量不是恒定的,因此每个项目的行数可能会有所不同。

我知道有一个 100% 可行的解决方案可以使用本机工具生成数据透视表 table,但我的目标是仅使用公式或脚本来实现。有什么办法吗?

这是实际的 sheet https://docs.google.com/spreadsheets/d/1tfeGbOOe7KVa0E4OlkZ9PMhM6xGoXaQVx4Yx7sU3qZU/edit?usp=sharing

这可能有帮助

=QUERY(A:C,"select A,B,count(C) where B <> '' group by A,B")
=ARRAYFORMULA({SPLIT(TRANSPOSE(SPLIT(TRIM(QUERY("♠"&SORT(UNIQUE(FILTER(A2:A, A2:A<>"")))&
 TRANSPOSE(QUERY(TRANSPOSE(IF(LEN(QUERY(TRANSPOSE(QUERY(QUERY(A2:C,
 "select B,sum(C) where B<>'' group by B pivot A", 0), "offset 1", 0)), "offset 1", 0)), 
 "♠ ♦"&TRANSPOSE(SORT(UNIQUE(FILTER(B2:B, B2:B<>""))))&"♦"&QUERY(TRANSPOSE(QUERY(QUERY(A2:C,
 "select B,sum(C) where B<>'' group by B pivot A", 0), "offset 1", 0)), "offset 1", 0), ))
 , , 999^99))&"♠ ♦Total:♦"&MMULT(QUERY(TRANSPOSE(QUERY(QUERY(A2:C,
 "select B,sum(C) where B<>'' group by B pivot A", 0), "offset 1", 0)), "offset 1", 0)*1,
 TRANSPOSE(SPLIT(REPT(COUNTUNIQUE(B2:B)&"♦", COUNTUNIQUE(B2:B)), "♦")^0)), , 999^99)), 
 "♠")), "♦"); "", "Total:", SUM(C2:C)})