简体   繁体   中英

Query importrange to count to number of times a value is in a column

In this google sheet I have text data in range O3:O: https://docs.google.com/spreadsheets/d/1xNFVHLnQGkRgZdLmejCyU0BByOPBY8NMoIYj6SkTFGY/edit?usp=sharing

My objective: Query + importrange to count the number of times a value in cell A3 within sheet2, appears within the importrange "/1xNFVHLnQGkRgZdLmejCyU0BByOPBY8NMoIYj6SkTFGY/edit#gid=0": "June!O3:O"

This is what I have so far but returns #value

=QUERY(IMPORTRANGE("/1xNFVHLnQGkRgZdLmejCyU0BByOPBY8NMoIYj6SkTFGY/edit#gid=0", "June!O3:O"),"select Col1, count(Col1) where Col1='"&A3&"' group by Col1, Col1 order by Count(Col1)", 1)

Update: I have now been able to get the correct count to appear but, this formula also returns searched value in the column the query is added and text 'count' above the returned result.

I just need the count to appear in the same cell as the formula without anything else returned

=QUERY(IMPORTRANGE("/1xNFVHLnQGkRgZdLmejCyU0BByOPBY8NMoIYj6SkTFGY/edit#gid=0", "June!O3:O"),"select Col1, count(Col1) where Col1='"&A3&"' group by Col1", 0) 

try:

=COUNTA(IFNA(QUERY({IMPORTRANGE(
 "1xNFVHLnQGkRgZdLmejCyU0BByOPBY8NMoIYj6SkTFGY", "June!O3:O")}, 
 "where Col1='"&A3&"'", 0)))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM