Archive of Mr Excel Message Board

Back to Dates in Excel archive index
Back to archive home

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?

Re: Check if a cell contains a date?

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.

This archive is from the original message board at
All contents © 1998-2004
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.