Dates in formula

gncntry96

New Member
Joined
Sep 4, 2011
Messages
5
My formula:
=IF(AND(E18>=1/1/2007,E18<=12/31/2007,E18+180, " ")

The problem:
It's returning false, even though my E18 date is 3/15/2007. I have formatted E18 as a date mm/dd/yyyy so I'm not sure why the problem. When I look at the function arguments, the first part shows true, the second shows false.

Any thoughts?
Thanks!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
You need to do this

=IF(AND(E18>="1/1/2007"+0,E18<="12/31/2007"+0),E18+180,"")

or for complete unambiguity use DATE function

=IF(AND(E18>=DATE(2007,1,1),E18<=DATE(2007,12,31)),E18+180, " ")

....although in this particular case if you just want to check whether the date is in 2007 you can use YEAR function, i.e.

=IF(YEAR(E18)=2007,E18+180,"")
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

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