Date & Quarters

raheem

New Member
Joined
Apr 24, 2017
Messages
38
Hi,

I need a simple formula to get the quarter number from date. In below table, if column A is already date, it should mention the quarter in column B. But if column A is already quarter, it should simply equal in column B. Changing date format is not an option. I tried to create a formula with IF+MONTH+SWITCH etc. but it becomes too complex to understand for other users.

[TABLE="width: 227"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[/TR]
[TR]
[TD="align: center"]01.01.2018[/TD]
[TD="align: center"]Q1[/TD]
[/TR]
[TR]
[TD="align: center"]05.02.2018[/TD]
[TD="align: center"]Q1[/TD]
[/TR]
[TR]
[TD="align: center"]10.03.2019[/TD]
[TD="align: center"]Q1[/TD]
[/TR]
[TR]
[TD="align: center"]03.04.2019[/TD]
[TD="align: center"]Q2[/TD]
[/TR]
[TR]
[TD="align: center"]31.05.2018[/TD]
[TD="align: center"]Q2[/TD]
[/TR]
[TR]
[TD="align: center"]Q2[/TD]
[TD="align: center"]Q2[/TD]
[/TR]
[TR]
[TD="align: center"]Q2[/TD]
[TD="align: center"]Q2[/TD]
[/TR]
[TR]
[TD="align: center"]Q3[/TD]
[TD="align: center"]Q3[/TD]
[/TR]
[TR]
[TD="align: center"]Q3[/TD]
[TD="align: center"]Q3[/TD]
[/TR]
[TR]
[TD="align: center"]Q4[/TD]
[TD="align: center"]Q4[/TD]
[/TR]
[TR]
[TD="align: center"]Q4[/TD]
[TD="align: center"]Q4[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi, you could try:

=IF(ISNUMBER(A2),"Q"&ROUNDUP(MONTH(A2)/3,0),A2)
 
Upvote 0
Hi, you could try:

=IF(ISNUMBER(A2),"Q"&ROUNDUP(MONTH(A2)/3,0),A2)

Doesn't work. Probably because ISNUMBER returns FALSE as the input is having two dots (01.01.2018 not recognized as number)
Also, there is no standard date format in A2, so how can MONTH(A2) identify a month out of A2.
 
Last edited:
Upvote 0
Doesn't work. Probably because ISNUMBER returns FALSE

Hi, it wasn't clear that your dates were text and not real excel date serial numbers.

I would probably advise converting your text dates to real dates - but here is an alternative you can try.

=IF(LEFT(A2)="Q",A2,"Q"&ROUNDUP(MID(A2,4,2)/3,0))
 
Last edited:
Upvote 0
As I said in start, changing format is not an option. But the alternative is also fine.

Thanks
 
Upvote 0
Hi, it wasn't clear that your dates were text and not real excel date serial numbers.

I would probably advise converting your text dates to real dates - but here is an alternative you can try.

=IF(LEFT(A2)="Q",A2,"Q"&ROUNDUP(MID(A2,4,2)/3,0))

As I said in start, changing format is not an option. But the alternative is also fine.

Thanks
 
Upvote 0
FormR was not asking you to change the format. He was asking you to supply dates as real dates, not text looking like dates.
If they were real dates, they could still look like 10.01.2019, then ISNUMBER would work.
 
Upvote 0
Hi, I am using this formula ="Q" & ROUNDUP(MONTH(A2)/3,0) & " "&year(A2). However some of the cells in A2 are blank and the value Q1 1900 is returned instead of blank. I have tried to add IFERROR but is till returning Q1 1900.

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Dates[/TD]
[TD]Quarters[/TD]
[TD]Expected result[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD]Q1 1900[/TD]
[TD]Blank[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]30/09/2019[/TD]
[TD]Q3 2019[/TD]
[TD]Q3 2019[/TD]
[/TR]
</tbody>[/TABLE]


I would really appreciate any help with this issue
 
Upvote 0
Hi, I am using this formula ="Q" & ROUNDUP(MONTH(A2)/3,0) & " "&year(A2). However some of the cells in A2 are blank and the value Q1 1900 is returned instead of blank. I have tried to add IFERROR but is till returning Q1 1900.

I would really appreciate any help with this issue

How about this

=IF(ISBLANK(A2),"","Q"&ROUNDUP(MONTH(A2)/3,0)&" "&YEAR(A2))
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,164
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top