How to Use TODAY() Function in Query using Query function

Using the TODAY() function in a query using the Query function in Google Sheets is quite simple. The TODAY() function is used to get the current date, and you can use it within the Query function to filter or manipulate data based on the current date.

Here's a step-by-step guide on how to use the TODAY() function with the Query function in Google Sheets:

  1. First, create a dataset in your Google Sheet. For this example, we will use the following dataset:
Date Item Quantity
2022-01-01 A 10
2022-01-02 B 15
2022-01-03 C 20
2022-01-04 A 30
2022-01-05 B 25
2022-01-06 C 35
  1. Next, let's say you want to retrieve all the records for today's date. You can use the Query function with the TODAY() function to accomplish this:
=QUERY(A1:C6, "SELECT * WHERE A = date '"&TEXT(TODAY(), "yyyy-MM-dd")&"'")

This formula will return all records where the date in column A matches the current date.

Example

Let's say your dataset is as follows:

Date Item Quantity
2022-01-01 A 10
2022-01-02 B 15
2022-01-03 C 20
2022-01-04 A 30
2022-01-05 B 25
2022-01-06 C 35

If today's date is 2022-01-04, then using the following Query function with TODAY():

=QUERY(A1:C6, "SELECT * WHERE A = date '"&TEXT(TODAY(), "yyyy-MM-dd")&"'")

You would get the following result:

Date Item Quantity
2022-01-04 A 30

This shows that the Query function, combined with the TODAY() function, has successfully filtered the data to only display records where the date in column A matches the current date.

Did you find this useful?