Formula comparing cell to fixed date always returns false

The following formulas in Excel 2010 both give me a "No" answer:

Formula:

=IF(S8="24/03/2015","Yes","No")

where S8 has format/value dd/mm/yyyy / 24/03/2015

=IF(S9>"30/06/2013","Yes","No")

where S9 has format/value dd/mm/yyyy / 24/03/2015

The data was originally loaded from a text file generated with the dos command dir /s > Dir.txt.

I've tried copying/formatting values, datevalue() and other internet suggested solutions to no avail.

I need a Guru's help!

1

5 Answers

Take the quotes off of the dates in your formula. It is trying to find the greater of two text values instead of the greater of two date values.

2

if your S8 is date,

try this

=IF(S8 = Date(yyyy;mm;dd);"Yes";"No")

if your S8 is date, compare it with date as well...

6

If dates are stored as date but formatted as dd/mm/yyyy you can use this function:

=IF(S8=DATE(2015,3,24),"Yes","No")

You can use these functions without any fuss:

=IF(S8=DATEVALUE("24/03/2015"),"Yes","No")
=IF(S8=DATE(2015,3,24),"Yes","No")

But be warned, if your date inside the DATEVALUE formula is not the same as your localization settings there will be ambiguity. For example: 5/1/2015. Is it January 5th or May first?

I tried this and it worked in Excel 2010:

=IF(S8=DATEVALUE("24/3/2015"),"Yes","No")
=IF(S9>DATEVALUE("30/06/2013"),"Yes","No")

Basically what's going on it's that you have "24/3/2015" but excel may take this a 2 divisions, like 24 divided by 3, and then that divided by 2015.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like