Formula with date ranges

sunrise06

Active Member
Joined
Oct 27, 2006
Messages
262
Office Version
  1. 365
Platform
  1. Windows
I have a long column of dates that I want to segment by year. For example, =IF(AND(C2>=8/1/2018,C2<=7/30/2019),"2018-2019",""). This will give me for one year, but how do I write the formula for say a 10 year span of dates so that 8/1/2017<>7/30/2018 will then give me 2017-2018, etc?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
You will need to continue on the same line of thought and create a nested if statement:
=IF(AND(C2>=8/1/2018,C2<=7/30/2019),"2018-2019",AND(C2>=8/1/2017,C2<=7/30/2018),"2017-2018","")
And so on...
 
Upvote 0
Thanks, I am getting an error - You've entered too many arguments for this function.
 
Upvote 0
Here's another thought that formats the range based on relative position from August 1st.
=IF(0 < DAYS(DATE(YEAR(C2),8,1),C2),TEXT(YEAR(C2) -1,"####")&"-"&TEXT(YEAR(C2),"####"),TEXT(YEAR(C2),"####")&"-"&TEXT(YEAR(C2)+1,"####"))
 
Upvote 0
Forgot to add the IF portion

=IF(AND(C2>=8/1/2018,C2<=7/30/2019),"2018-2019",IF(AND(C2>=8/1/2017,C2<=7/30/2018),"2017-2018",""))
 
Upvote 0

Forum statistics

Threads
1,215,331
Messages
6,124,311
Members
449,152
Latest member
PressEscape

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