Excel Formula to Return Quarter and Year
In this article
To return the quarter and year from a date in Excel, use the formula ="Q"&ROUNDUP(MONTH(A1)/3,0)&" "&YEAR(A1), where A1 is the cell containing your date. This combines the ROUNDUP and MONTH functions to determine the three-month block (quarter) and the YEAR function to extract the calendar year, joining them together with a text string.
What You'll Need
- A computer with Microsoft Excel installed (works in all modern versions including Excel 365, 2021, 2019, and 2016).
- A dataset containing valid date values.
- Basic knowledge of how to click into a cell and enter a formula.
Step-by-Step
- Identify your date source: Locate the column where your dates are stored. For this guide, we will assume your date is in cell A2. Ensure the cell is actually formatted as a "Date" and not as "Text," otherwise the formula will return a #VALUE! error.
- Select the destination cell: Click on the cell where you want the quarter and year to appear (for example, cell B2).
- Enter the Quarter logic: Start by typing
="Q"&ROUNDUP(MONTH(A2)/3,0). Here is the breakdown of what this does: the MONTH function extracts the number of the month (1-12). Dividing by 3 converts the month into a quarter value (e.g., month 5 divided by 3 is 1.66). The ROUNDUP function forces that number up to the nearest whole integer, meaning months 1, 2, and 3 become 1; months 4, 5, and 6 become 2, and so on. - Add the Year logic: To append the year to the quarter, add a space and the YEAR function. Your formula should now look like this:
="Q"&ROUNDUP(MONTH(A2)/3,0)&" "&YEAR(A2). The ampersand (&) symbol is used to concatenate, or glue together, the text "Q", the calculated quarter number, a space, and the four-digit year. - Press Enter: Once the formula is typed, press the Enter key. You should see a result like "Q2 2023".
- Apply to the rest of the column: Hover your mouse over the bottom-right corner of cell B2 until the cursor turns into a small black cross (the fill handle). Click and drag the handle down to the bottom of your dataset to apply the formula to all rows.
- Optional: Convert formulas to values: If you do not want the cells to change if the source dates are deleted, select the cells with the formulas, copy them (Ctrl+C), right-click the selection, and choose "Paste Values" (the icon with the numbers 123).
Common Mistakes
One of the most frequent errors is forgetting the quotation marks around the "Q" or the space. In Excel, any literal text inside a formula must be enclosed in double quotes. If you type =Q&ROUNDUP..., Excel will think you are trying to reference a named range called "Q" and will return a #NAME? error.
Another common mistake is using the ROUND function instead of ROUNDUP. The standard ROUND function follows mathematical rounding rules (0.5 and up rounds up, below 0.5 rounds down). Because the quarter calculation involves dividing by 3, using ROUND would result in incorrect quarters for certain months. For instance, Month 1 (January) divided by 3 is 0.33; ROUND would turn this into 0, which is not a valid quarter. ROUNDUP ensures that any fraction of a quarter is pushed to the next whole number.
Users also frequently attempt to use this formula on cells that look like dates but are actually stored as text. If a date was imported from a CSV or another software and is left-aligned in the cell, it might be text. The MONTH and YEAR functions only work on serial date numbers. If your data is text, the formula will fail.
Tips
If you prefer a different format, such as "2023-Q2", simply rearrange the order of the concatenation. The formula would be =YEAR(A2)&"-Q"&ROUNDUP(MONTH(A2)/3,0). This format is often better for sorting purposes, as alphabetical sorting will naturally follow the chronological order of the years first.
For those using Excel 365 or Excel 2021, you can use the LET function to make the formula cleaner and more efficient, especially if you are performing multiple calculations on the same date. For example: =LET(d, A2, "Q"&ROUNDUP(MONTH(d)/3,0)&" "&YEAR(d)). This assigns the date in A2 to the variable "d", reducing the number of times Excel has to look up the cell value.
If you need to perform calculations based on these quarters (like summing sales), it is often better to keep the Quarter and Year in two separate columns. Use =ROUNDUP(MONTH(A2)/3,0) in one column and =YEAR(A2) in another. This allows you to use Pivot Tables to group your data more effectively without needing complex text-parsing formulas.
Troubleshooting
If your formula returns #VALUE!, the most likely cause is that the cell referenced is not a valid date. To check this, use the formula =ISNUMBER(A2). If it returns FALSE, your date is stored as text. To fix this, select the column of dates, go to the Data tab, select Text to Columns, and click Finish immediately. This often forces Excel to re-evaluate the text as dates.
If your formula returns a #NAME? error, check your spelling of the functions. Ensure you have written ROUNDUP, MONTH, and YEAR correctly. Also, check that you haven't missed the quotation marks around your text strings.
If the result looks like a strange number (e.g., 44927) instead of "Q1 2023", you may have accidentally applied a Date format to the cell containing the formula. Because the formula results in a text string, the cell should be formatted as "General". Select the cell, go to the Home tab, and change the number format dropdown to General.
If the quarter is calculating incorrectly (e.g., January is showing as Q0), double-check that you used ROUNDUP and not ROUND or ROUNDDOWN. The division of the month by 3 must always be rounded up to the next integer to align with standard calendar quarters.
Frequently Asked Questions
Can I use this formula for a fiscal year that doesn't start in January?
Yes, but the formula must be adjusted. If your fiscal year starts in April, you would subtract 3 from the month: =ROUNDUP(MONTH(EDATE(A2,-3))/3,0). The EDATE function shifts the date back by three months so that April is treated as the first month of the year.
Will this formula work in Google Sheets?
Yes, this exact formula is compatible with Google Sheets as both platforms use the same syntax for MONTH, YEAR, ROUNDUP, and concatenation.
Is there a way to do this without a formula using Pivot Tables?
Yes. If you put a date field into the Rows area of a Pivot Table, you can right-click any date in the table and select Group. From the menu, you can select both "Quarters" and "Years", and Excel will automatically create the groupings for you without any formulas.
How do I change the output to say "Quarter 1" instead of "Q1"?
Simply change the text inside the quotation marks at the beginning of the formula. Use ="Quarter "&ROUNDUP(MONTH(A2)/3,0)&" "&YEAR(A2). Note the extra space after the word Quarter to ensure the number doesn't touch the word.
Can I use this to find the quarter of today's date?
Yes. Replace the cell reference (A2) with the TODAY() function. The formula would be ="Q"&ROUNDUP(MONTH(TODAY())/3,0)&" "&YEAR(TODAY()). This will always display the current quarter and year based on your system clock.