Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

aggregate - How to combine all the columns in into one and count them respectively in google sheet?

Data

Hi everyone,

I have 3 columns of data for the age of people in a city and also 3 columns of the count for the ages. I want to combine all the 6 columns into 2 columns which means there will be only one column of age data and one column for number of count. I try to use query function in googlesheet but not sure how to use it. Please give me some advice on this if there is other method that can achieve the same result. Thank you.


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

1 Reply

0 votes
by (71.8m points)

Try

=query({G8:H; J9:K; M9:N}, "Select Col1, sum(Col2) where Col1 is not null group by Col1 label sum(Col2) 'Count of people'", 1)

and see if that works?

and see if that works?

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...