简体   繁体   中英

I want to use this query as an arrayformula

Can anyone suggest to me how I can convert this query into something that will work in an arrayformula?

=iferror(QUERY(importorders!A:H,"Select count(A) where C = 'Thailand Tour' and month(H) = "&MONTH(A3)-1&"and year(H) = "&year(A3)&" label count(A) ''",1),0)

It's basically just counting to see how many orders I had in each month.

Thanks for looking.

View sheet (image)

Sheet: https://docs.google.com/spreadsheets/d/1Of6cdFYaOzCFwPdZ4ABItD6dghMjHhafRWmDJWaznbg/edit#gid=711075203

You have to use group by

To get just for Thailand Tour

To get results for the whole column try this

(A demo sheet with expected results would be really helpful)

try:

=ARRAYFORMULA(IFNA(VLOOKUP(A3:A, QUERY({importorders!A2:C, 
 EOMONTH(importorders!H2:H, -1)+1},
 "select Col4,count(Col1) 
  where Col3 = 'Thailand Tour' 
    and Col4 is not null 
  group by Col4
  label count(Col1)''", 0), 2, 0), 0))

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