MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Check if a cell contains a date?

Posted by Braddo on August 22, 2001 1:40 PM


I'd like to set up a cell to indicate which format EXCEL has picked for the value in another cell. This is fairly straightforward for numbers and text because MS provides the ISTEXT and ISNUMBER functions. However, there is no ISDATE function and all dates are stored as numbers in EXCEL of course.

Now, the manual indicates that there is a VB function called IsDate, but I'd prefer not to be writing VB for this little project.

Any ideas how to check the format of a cell?

Posted by Mark W. on August 22, 2001 1:59 PM

Take a look at the CELL worksheet function.
=CELL("format",A1) will return "Dx" where x is
a number between 1 and 5 inclusive if A1 is
formatted using a built-in date format.