Sameer Farooqui
Sameer Farooqui

Reputation: 117

Google sheet - how to filter the data with custom date range

I know this can be achieved with pivot in google sheet but it wont let us to select the date range to fetch the results in pivot. What i need is when I select the date range and agent in sheet 2 it returns me the result with total uploaded qty.

My Data Set in Sheet 1

enter image description here

Result Required in Sheet 2

enter image description here

Any help will be highly appreciated.

Upvotes: 1

Views: 1664

Answers (1)

player0
player0

Reputation: 1

try:

={QUERY(Data!A:D, 
 "where A = '"&C2&"' 
    and B >= date '"&TEXT(A2, "yyyy-mm-dd")&"' 
    and B <= date '"&TEXT(B2, "yyyy-mm-dd")&"'", 1); "","", "Total", 
 IFNA(SUM(QUERY(Data!A:D, 
 "select D 
  where A = '"&C2&"' 
    and B >= date '"&TEXT(A2, "yyyy-mm-dd")&"' 
    and B <= date '"&TEXT(B2, "yyyy-mm-dd")&"'", 0)), "")}

0

Upvotes: 1

Related Questions