Hi Reader,
Welcome to the Google Sheets Tips newsletter #204!
I. The QUERY Function Course
In case you missed the announcement earlier today, my newest course is now open for enrollment! Find out more:
The QUERY Function in Google Sheets
(Enjoy 50% off this week, until Friday at midnight EDT.)
_______
Here is your Google Sheets tip, which you can think of as your Monday morning espresso, in spreadsheet form.
Working with dates in the QUERY function is tricky.
With today's tip, I want to show you how to reference dates correctly in the QUERY function.
If you simply drop a date into your QUERY function, for example as a condition in the WHERE filter, it won't return the data you're looking for.
This formula does NOT return any data:
=QUERY( A1:E100 , "select * where B > '5/16/2022' ")
The QUERY function needs dates in the ISO format, which is "YYYY-MM-DD".
That's a 4-digit year, a dash, two digits for the month, a dash, and finally, two digits for the day.
For example, today's date is written 2022-05-16.
Putting that into the formula looks like this:
=QUERY( A1:E100 , "select * where B > '2022-05-16' ")
Unfortunately, it still doesn't return any results. Hmm, there's one more thing we need to do...
The last piece of the puzzle is to add the "date" keyword before the date in your filter condition, like this:
=QUERY( A1:E100 , "select * where B > date '2022-05-16' ")
Woohoo!
Now the QUERY function will parse the data correctly and return all data after today's date.
Read more about filtering dates with the QUERY function.
Or, dive deep into the QUERY function (including dates!) in my new course:
The QUERY Function in Google Sheets
_______
If you enjoyed this newsletter, please forward it to a friend who might enjoy it.
Have a great week!
Cheers,
Ben
Get better at working with Google Sheets! Join 50,000 readers to get an actionable tip in your inbox every Monday.
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #354, your Monday morning espresso, in spreadsheet form! In last week's newsletter we compared wide and tall data, and what the pros and cons of each data "shape" were. Today, I want to show you how to move from one format to the other. How to transform tall data into wide data and vice versa. Going in one direction is easy. Going back, in the other direction, is less so. Find out which way round below! ➜ News I. It's...
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #353, your Monday morning espresso, in spreadsheet form! Today we're looking at the shape of data. It's foundational concept that underpins pivot tables and charts in Google Sheets. Once you understand the difference between wide data (for charts) and tall data (for pivot tables), you'll be off to the races! This week is all about the pros and cons of each data shape. Next week, I'll show you how to use formulas and...
Brought to you by: Hi Reader, Welcome to the Google Sheets Tips newsletter #352, your Monday morning espresso, in spreadsheet form! If you're a parent, then you've undoubtedly watched a lifetime's worth of Disney movies. You can appreciate the genius storytelling, rich characters and beautiful visuals. (But I'm sure you'd also be content to watch a film once, not 10 times!) Anyway, there's a scene in the Disney film Ratatouille where Remy bites into a strawberry and a piece of cheese at the...