Determine if a date falls between two dates

sunrise06

Active Member
Joined
Oct 27, 2006
Messages
262
Office Version
  1. 365
Platform
  1. Windows
I am trying to determine if a date falls between two dates. I am using the following formula:

=IF(AND(A2>=$D$1,A2<=$E$1),"T","F") with D1=8/27/2018 and E1=8/27/2018

I get the right answer. However, if I change the formula and replace the absolute reference dates with actual dates as shown here, I do not get the right answer.

=IF(AND(A2>=8/27/2018,A2<=8/27/2019),"T","F")

Any ideas why?

Additionally, if anyone has a better formula, I need a formula to review over several years.

Thanks
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
It is treating is as division and not a date.

Here is one way to get around that:
=IF(AND(A2>=DATEVALUE("8/27/2018"),A2<=DATEVALUE("8/27/2019")),"T","F")
 
Upvote 0
Ahh, thank you! I was stumped. Any suggestions on how to create a formula for looking over several years. For example:

START DATEEND DATE
8/27/2014​
8/27/2015​
8/27/2015​
8/27/2016​
8/27/2016​
8/27/2017​
8/27/2017​
8/27/2018​
8/27/2018​
8/27/2019​
8/27/2019​
8/27/2020​
8/27/2020​
8/27/2021​
 
Upvote 0
Any suggestions on how to create a formula for looking over several years.
Not sure what you mean.
What seems to be the difficulty?
Why would it be any different?
 
Upvote 0
I wondered if there was a better formula rather than stringing along ALL of these dates in one formula.

Thnaks
 
Upvote 0
Ah, I think I see now. Since they all are the same day and month, here is one way:
=IF(AND(YEAR(A2)>=2014,YEAR(A2)<=2021,MONTH(A2)=8,DAY(A2)=27),"T","F")
 
Upvote 0

Forum statistics

Threads
1,215,398
Messages
6,124,688
Members
449,179
Latest member
kfhw720

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