Reputation: 155
I am trying to count the total number of orders today with the query function and sort.
I can count it by status through this.
=QUERY('2021'!A1:AA5000, "select G,
count(V) where V is not null and V ='In Process'
group by G
order by count(V) desc
label count(V) 'New Order'")
but not sure how to count it by date I have column C with date format yyyy-mm-dd. I wanted to show the total numbers of orders yesterday. I tried this
=QUERY('2021'!A1:AA5000, "select G,
count(C) where C is not null and C =TODAY()-1
group by G
order by count(C) desc
label count(C) 'yesterday Orders'")
it throws a #value or #error
please help
Upvotes: 0
Views: 143
Reputation: 27262
Try
=QUERY('2021'!A1:G, "select G, count(C) where C = date '"&TEXT(TODAY()-1, "yyyy-mm-dd")&"' group by G order by count(C) desc label count(C) 'yesterday Orders'", 1)
and see if that works?
Upvotes: 1