The Quarter() is one of the scalar functions in Google Sheets Query. There is no such function that you can use directly within a cell in Sheets. So in order to extract the quarter from a date in Google Sheets, you can use a custom formula.
There are four quarters in a year that means each quarter consists of 3 months (12/4). It would be like;
- Jan to Mar – Q1
- Apr to Jun – Q2
- Jul to Sep – Q3
- Oct to Dec – Q4
I’ll explain to you how to extract a quarter from a date (non-array formula) and also extract quarters from a date range (array formula).
Non-Array Formula to Return Quarter from a Date in Google Sheets
The date 26/06/2019 falls in quarter 2, right? From this date, I want to return the corresponding quarter 2 using a formula. Assume this date is in cell C2.
Here is the formula to extract the quarter from the above date in Google Sheets. I have used the ROUNDUP and MONTH functions for this.
=ROUNDUP(month(C2)/3,0)
Sometimes you may want to add the string “Q” or “Quarter” to the above output. You can use the below formula for that.
="Quarter "&ROUNDUP(month(C2)/3,0)
In this change “Quarter” to “Q” to return Q2.
Array Formula to Return Quarter from a Date Range in Google Sheets
If you have a date range in C2:C5, you can simply copy the quarter formula in cell D2 to the range D3:D5. What about converting the quarter formula to an array formula?
Quarter ArrayFormula:
=ArrayFormula("Quarter "&ROUNDUP(month(C2:C5)/3,0))
Here is the same formula for an infinite range.
=ArrayFormula(if(C2:C<>"","Quarter "&ROUNDUP(month(C2:C)/3,0),))
Date Range to Quarter Using Query Quarter Function
Since the Query function has the Quarter function built-in, instead of the above array formula, you can use the Query in Google Sheets.
You can easily replace the above Quarter array formula with the following Query.
=query(C2:C,"Select quarter(C) label quarter(C)''")
If you want to summarise your data by Quarterly, the better way is to use the Quarter function in Query. Here is one example – Formula to Group Dates by Quarter in Google Sheets.
That’s all about the date to quarter conversion in Sheets. Enjoy!
Additional Resources:
- Month, Quarter, Year Wise Grouping in Pivot Table in Google Sheets.
- Query to Create Daily/Weekly/Monthly/Quarterly/Yearly Report Summary in Google Sheets.
- Weekday Name to Weekday Number in Google Sheets.
- Formula to Convert Month Name in Text to Month Number in Google Sheets.
- Google Sheets Query: How to Convert Month in Number to Month Name in Text.
- Convert Numbers to Month Name in Google Sheets.
How might I split data across a date range by quarter? Example:
Data: sold 150 units during the date range from Jan 15 to July 15.
Query: On average, how many were sold in Q1, Q2, Q3, and Q4?
Answer: Q1: 50 Q2: 50 Q3: 50 Q4: 0
Hi, Roger Brownlie,
You can either use a Query Formula or a Pivot Table.
Please search “Formula to Group Dates by Quarter in Google Sheets” within this tutorial to find the relevant tutorial.