Nested IF for Quater between two dates

Chandresh

Board Regular
Joined
Jul 21, 2009
Messages
146
HI all,

need a help on nested if formula for calculating the quarter based on start date and end date

follow is the table

[TABLE="width: 322"]
<colgroup><col><col><col span="2"><col></colgroup><tbody>[TR]
[TD]Date[/TD]
[TD]Result[/TD]
[TD]Start[/TD]
[TD]End[/TD]
[TD]Output[/TD]
[/TR]
[TR]
[TD="align: right"] 03-10-2017[/TD]
[TD][/TD]
[TD="align: right"]01-04-2017[/TD]
[TD="align: right"]15-06-2017[/TD]
[TD]Q1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]16-06-2017[/TD]
[TD="align: right"]15-09-2017[/TD]
[TD]Q2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]16-09-2017[/TD]
[TD="align: right"]15-12-2017[/TD]
[TD]Q3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]16-12-2017[/TD]
[TD="align: right"]15-03-2018[/TD]
[TD]Q4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]16-03-2018[/TD]
[TD="align: right"]31-03-2018[/TD]
[TD]Q5[/TD]
[/TR]
</tbody>[/TABLE]
column A is the date for which I need quarter in column B.

Example 03-10-2017 comes between 16-09-2017(start date) and 15-12-2017(end date) then my result in column B should be Q3.

Thanks
Chandresh
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
What if you start date and end span two quarters?, i.e.
Start Date: 15-03-2018
End Date: 14-04-2018

What would you want to return in that instance?

Also, I see that you have Q5, instead of starting over at Q1.
Does that mean that you have one initial start date for the very first quarter, and for subsequent years, instead of starting over with Q1, you are going to keep incrementing?
That would seem to imply that 01-01-2017 is your initial start date, and you would never have any dates less than that. Is that correct?
 
Upvote 0
[TABLE="class: cms_table, width: 322"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Result[/TD]
[TD]Start[/TD]
[TD]End[/TD]
[TD]Output[/TD]
[/TR]
[TR]
[TD="align: right"] 03-10-2017[/TD]
[TD][/TD]
[TD="align: right"]01-04-2017[/TD]
[TD="align: right"]15-06-2017[/TD]
[TD]Q1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]16-06-2017[/TD]
[TD="align: right"]15-09-2017[/TD]
[TD]Q2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]16-09-2017[/TD]
[TD="align: right"]15-12-2017[/TD]
[TD]Q3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]16-12-2017[/TD]
[TD="align: right"]15-03-2018[/TD]
[TD]Q4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]16-03-2018[/TD]
[TD="align: right"]31-03-2018[/TD]
[TD]Q5[/TD]
[/TR]
</tbody>[/TABLE]

My start date and end date is constant for each Quarter Example : 01-04-2017 to 15-06-2107 is my Q1, 16-06-2017 to 15-09-2017 is my Q2.

so whatever date comes in between this dates will fall in that bracket.
 
Upvote 0
Sorry, I totally misread your question.

What you want can be done pretty easily using VLOOKUP. Just set up a three column table with Start Date, End Date, and Output, like you have shown above.
For simplicity sake, we can then make this a named range (see: https://www.contextures.com/xlNames01.html). Let's name it "MyDates".

Now, let's say that you have a date in cell A2, and what to see which quarter it falls in. Use this formula:
Code:
=VLOOKUP(A2,MyDates,3,True)
 
Upvote 0
Yes I have arranged the data and used =VLOOKUP(A1,$C$1:$D$5,2,TRUE) its working

[TABLE="width: 236"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD="align: right"]01-04-2017[/TD]
[TD]Q1[/TD]
[TD="align: right"]01-04-2017[/TD]
[TD]Q1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]16-06-2017[/TD]
[TD]Q2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]16-09-2017[/TD]
[TD]Q3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]16-12-2017[/TD]
[TD]Q4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]16-03-2018[/TD]
[TD]Q5[/TD]
[/TR]
</tbody>[/TABLE]

thanks for your help
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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