我有一个简单的两列数据集:
Users | Action
---------------
User 1 | Payment
User 2 | Payment
User 3 | Payment
User 4 | Confirm
User 2 | Confirm
并希望制作此摘要:
User | Payment| Confirm
-------------------------
User 1 | TRUE | FALSE
User 2 | TRUE | TRUE
User 3 | TRUE | FALSE
User 4 | FALSE | TRUE
这是一个样本表
https://docs.google.com/spreadsheets/d/1869dg2-0bNPFTBs-QtCiFdXC16ih8rAL4g8PihEUwLk/edit?usp=sharing
数据本身将来自Google Analytics加载项。 Action
是给定的,而不是动态的。
答案 0 :(得分:1)
通过操纵输入数组并将它们传递给查询,我们得到了请求的结果:
=ARRAYFORMULA(QUERY({A2:A6,--(B2:B6="Payment"),--(B2:B6="Confirm")},"Select Col1,Sum(Col2),sum(Col3) group by Col1 label sum(Col2) 'Payment', sum(Col3) 'Confirm' format sum(Col2) 'TRU\E;;FAL\S\E',sum(Col3) 'TRU\E;;FAL\S\E'"))