How to Group Dates by Quarter in Google Sheets

By “grouping dates by quarter,” we mean organizing a date column by quarter, then adding additional columns (if any), and aggregating another column.

You can use either a formula-based approach or a pivot table approach to group dates by quarter in Google Sheets. While the formula approach gives you the flexibility to format the data, the pivot table provides a standardized data format.

In the formula-based approach, there are two ways to group by quarter: one using a helper column with various functions and combinations, and another without a helper column (using the QUERY function).

Sample Data

We have the following sample data in A1:C, where A1:C1 contains the headers:

DateItemAmount
20/12/2023Apple100
21/12/2023Banana200
22/1/2024Mango150
22/5/2024Orange300
14/6/2024Apple120
25/9/2024Apple180
26/9/2024Apple220
1/10/2024Mango250
15/10/2024Mango130
09/12/2024Mango140

Group Dates by Quarter Using a Helper Column

1. Extract Quarter and Year

In cell D2, enter the following formula and drag it down to extract the quarter and year from the date:

=IFERROR("Q"&ROUNDUP(MONTH(DATEVALUE(A2))/3,0)&"-"&YEAR(DATEVALUE(A2)))

For a detailed explanation of this formula and additional tips, check out Extract Quarter from a Date in Google Sheets: Formulas.

2. Get Unique Quarters

To create a summary report, in cell F2, enter the following formula to get the unique quarters from column D:

=UNIQUE(D2:D)

3. Group by Quarter

To group by quarter, use the following SUMIFS formula in cell G2 and drag it down:

=SUMIFS($C$2:$C, $D$2:$D, $F2, $B$2:$B, G$1)
Grouping dates by quarter using a helper column - Approach 1 (without a category column)

Formula Explanation:

  • $C$2:$C (sum_range): The range containing the amounts to sum.
  • $D$2:$D (criteria_range1): The range containing the quarters.
  • $F2 (criterion1): The specific quarter to match (e.g., “Q1-2024”).

4. Item-Wise Summary

To include item-wise grouping, first, enter this formula in cell G1 to get unique items:

=TRANSPOSE(UNIQUE(B2:B))

Then replace the previous formula in cell G2 with this one:

=SUMIFS($C$2:$C, $D$2:$D, $F2, $B$2:$B, G$1)

Drag this formula across and down.

Grouping dates by quarter using a helper column - Approach 1.1 (with a category column)

Formula Explanation:

  • $C$2:$C (sum_range): The range containing the amounts to sum.
  • $D$2:$D (criteria_range1): The range containing the quarters.
  • $F2 (criterion1): The specific quarter to match (e.g., “Q1-2024”).
  • $B$2:$B (criteria_range2): The range containing the items.
  • G$1 (criterion2): The specific item to match (e.g., “Apple”).

Group Dates by Quarter Using QUERY

If you prefer not to use a helper column and want to group dates by quarter, QUERY is the best option. Use the following formula:

=QUERY(A1:C, "SELECT YEAR(A), QUARTER(A), SUM(C) WHERE A IS NOT NULL GROUP BY YEAR(A), QUARTER(A)", 1)

This QUERY formula groups the dates in column A by Year and Quarter and returns the total of column C (Amount). It filters out blank rows by ensuring A IS NOT NULL.

Grouping dates by quarter using QUERY - Approach 2 (without a category column)

If you want to include the item, use this formula:

=QUERY(A1:C, "SELECT YEAR(A), QUARTER(A), SUM(C) WHERE A IS NOT NULL GROUP BY YEAR(A), QUARTER(A) PIVOT B", 1)

The change here is the addition of PIVOT B, which distributes the sum across the unique items in column B (Item), effectively creating a pivot table layout.

Grouping dates by quarter using QUERY - Approach 2.2 (with a category column)

It’s that simple!

Note: You might want to modify the header row in the above summary. Learn how to do that by checking out this guide: Understand the Label Clause in Google Sheets Query.

Group Dates by Quarter Using a Pivot Table

This is the simplest approach, as it doesn’t involve any formulas. You can use the built-in pivot table feature to group dates by quarter in Google Sheets.

Steps:

  1. Select the data range A1:C.
  2. Click Insert > Pivot Table.
  3. In the popup, click Create to insert the pivot table into a new sheet.
  4. Drag and drop Date under Rows.
  5. If you want to include Items in the grouping, drag and drop Item under Columns (this step is optional).
  6. Drag and drop Amount under Values.
  7. Drag and drop Date under Filters.
    • Click the dropdown and select Cell is not empty under Filter by Condition.
    • Click OK.
  8. Right-click on any date in the pivot table you just created and select Create Pivot Date Group.
  9. Select Year-Quarter to group the dates by quarter.
Pivot table setup for grouping dates by quarter - Approach 3

That’s all you need to do!

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Compare Two Tables for Differences in Excel

To compare two tables with similar data for differences, you can use the XLOOKUP...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

More like this

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.