Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
167 views
in Technique[技术] by (71.8m points)

Google spreadsheet pivot table and join

My concern is about transforming an array to another one :
I have a table like this :

Name?Val 1? Val 2
Joe ? ?A ?? B
Karl? ??? ?C
Joe ? ?C ? ?B

I would like this table as result:

Name A?B?C
Joe? X?X?X
Karl?? ? ?X

I'm lost, I tried using query or ArrayFormula but I failed, if someone can solves this ..?

Thanks a lot

question from:https://stackoverflow.com/questions/65601057/google-spreadsheet-pivot-table-and-join

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

use:

=INDEX(REGEXREPLACE(""&QUERY(IFERROR(SPLIT(FLATTEN(
 IF(B2:C="",,A2:A&"×"&B2:C)), "×")), 
 "select Col1,count(Col1) 
  where Col2 is not null 
  group by Col1 
  pivot Col2 
  label Col1'Name'"), "d+", "X"))

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...