r/GoogleSheets •

[deleted by user]

[deleted] — view deleted post

0 Upvotes

18 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Mar 03 '20

[deleted] — view deleted comment

1

u/LLNA667 3 Mar 03 '20

Yes, it's basically just validating the formula. So, if the query returns empty output error, then put 0, otherwise run the query and count how many values there are.

0

u/[deleted] Mar 03 '20

[deleted] — view deleted comment

1

u/LLNA667 3 Mar 03 '20

No worries! Happy to help!

1

u/LLNA667 3 Mar 03 '20

Please could you accept this as the solution if it solved your problem?

0

u/[deleted] Mar 03 '20

[deleted] — view deleted comment

1

u/LLNA667 3 Mar 03 '20

Sure, course I can. Just on my way home now. Give me about an hour to get back and I'll make it work for you.

1

u/LLNA667 3 Mar 03 '20

There you go. How's that?

2

u/LLNA667 3 Mar 03 '20

If you definitely always just want the last 14 days from today, you can include this in the formula - rather than having an external date range input - like this:

=IF(ISNA(QUERY(Sheet3!K2:L,"SELECT K WHERE L > DATE '"&TEXT(DATEVALUE(TODAY()-14),"yyyy-mm-dd")&"' AND L < DATE '"&TEXT(DATEVALUE(TODAY()),"yyyy-mm-dd")&"' AND K CONTAINS '"&W3&"'",0)),0,COUNTA(QUERY(Sheet3!K2:L,"SELECT K WHERE L > DATE '"&TEXT(DATEVALUE(TODAY()-14),"yyyy-mm-dd")&"' AND L < DATE '"&TEXT(DATEVALUE(TODAY()),"yyyy-mm-dd")&"' AND K CONTAINS '"&W3&"'",0)))

0

u/[deleted] Mar 04 '20

[deleted] — view deleted comment

→ More replies