How to Format Date, Time, and Number in Google Sheets Query

Have you ever wondered how to easily format date, time, and number columns in Google Sheets Query? Look no further! In this guide, we will explore the Format clause, the last clause in the Query order, that allows you to effortlessly format your data. Whether you’re a Query expert or just getting started, this tutorial will walk you through the process step by step.

Formatting Date in Query Function

Formatting dates in Google Sheets Query is a breeze. All you need to do is use the Format clause in your formula to specify the desired format. For instance, if you want to display the date in the “dd-mmm-yyyy” format, simply use the following formula:

=QUERY(A1:G7,"SELECT * FORMAT C 'DD-MMM-YYYY'")

You can also customize the formatting to display only the year, month, or day. Here are a few examples:

  • Year: =QUERY(A1:G7,"SELECT * FORMAT C 'YYYY'")
  • Month: =QUERY(A1:G7,"SELECT * FORMAT C 'MM'")
  • Day: =QUERY(A1:G7,"SELECT * FORMAT C 'DD'")

Remember that the underlying values in the formatted cells will remain as dates, so take this into account when performing calculations.

Formatting Time in Query

Just like dates, you can format time in Google Sheets Query too. There are three types of time formatting options available:

  1. Hours only: =QUERY(A1:G7,"SELECT * FORMAT G 'HH'")
  2. Minutes and seconds: =QUERY(A1:G7,"SELECT * FORMAT G 'MM:SS'")
  3. Seconds only: =QUERY(A1:G7,"SELECT * FORMAT G 'SS'")

Choose the format that best suits your needs and apply it to your time data.

Formatting Number in Query

Formatting numbers is also possible with Google Sheets Query. Let’s take a look at two examples:

  1. Decimal format: =QUERY(A1:G7,"SELECT * FORMAT E '##,##0.00'")
  2. Whole number format: =QUERY(A1:G7,"SELECT * FORMAT E '##,##0'")

Apply these formulas to your sheet and see the formatting in action.

Applying Multiple Formatting Options in Query

Did you know that you can apply multiple formatting options at once using Google Sheets Query? It’s true! Simply separate the formatting clauses with commas. For example:

=QUERY(A1:G7,"SELECT * FORMAT C 'DD/MMM/YYYY', E '##,##0.00'")

This formula will format the date column as “dd/mmm/yyyy” and the number column with two decimal places.

Now that you know how to format date, time, and number in Google Sheets Query, the possibilities are endless. Start exploring and enjoy the power of data formatting with Query!

Learn more about Google Sheets Query on Crawlan.com

Related posts