0

I am trying to query two columns of data in Google Sheets and count how many times the values occur.

I have made a Google Sheets formula which works but only returns data in the first column.

=QUERY(QUERY({D2:D,E2:E}, "select Col1, count(Col1) group by Col1"), "select Col1, Col2 order by Col2 desc, Col1 limit 45", 0) 

How can I query and count data from both columns together?

enter image description here

DESIRED RESULT

2.38 / 2

5.38 / 2

...

I have made a Google Sheet showing an example. This can be copied by going to File-Make a Copy

https://docs.google.com/spreadsheets/d/1S5fE43JPVgUhZFVx-rjowkCy8N6p_ziIhIWe4MweiXQ/edit?usp=sharing

2 Answers 2

1

If your formula gives the correct output, you may need to change your comma with semicolon. That way all your data will be grabbed as a single column:

=QUERY(QUERY({D2:D;E2:E}, "select Col1, count(Col1) group by Col1"), "select Col1, Col2 order by Col2 desc, Col1 limit 45", 0) 
Sign up to request clarification or add additional context in comments.

Comments

0

Please try:

=QUERY({D2:D;E2:E},"Select Col1, COUNT(Col1) WHERE Col1 IS NOT NULL GROUP BY Col1 ORDER BY COUNT(Col1) DESC LABEL COUNT(Col1)''") 

enter image description here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.