# excel date check

all -

I have two cells  B10 and B11
I need to check both cells for valid dates prior to calculating the difference between the two.

What is the best in cell formula to check for a valid date. e.g. blanks, '-' ,  or NA, '2342jflsd'

thanks

ps

Cell B9 will have the formula for data checking and also will be the cell that holds the number of days difference between the two

LVL 1
###### Who is Participating?

x

=IF(OR(ISERR(DATEVALUE(B10)),ISERR(DATEVALUE(B11))), "Error", "Good")
0

Author Commented:
will be using:  =DATEDIF(B10,B11,"d")

for the diff formula.
0

You can use the ISERR and DATEVALUE functions together to determine if a string is a valid date:

=IF(ISERR(DATEVALUE("11/11/11")), "Error", "Good")
=IF(ISERR(DATEVALUE("111111")), "Error", "Good")
0

Author Commented:
How do I 'OR' the statements:

example:

B9 = needs to check both B10 and B11

This code will be in cell B9 and error needs to be return if B10 OR B11 is false.
=IF(ISERR(DATEVALUE("11/11/11")), "Error", "Good")
0

Author Commented:
sorry for the delay.

thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.