Excel date format trouble

  • Thread starter Thread starter michaelberrier
  • Start date Start date
M

michaelberrier

I am using a magnetic stripe reader to enter a DL expiration date into
a cell. The date on the stripe is formatted as YYMM, so April of 2006
would look like 0604. The trouble comes when I want to compare that
date to today's to automatically detect an expired document.

Excel will allow a date in that format as long as it is entered that
way to start with. Otherwise, Excel will interpret the number 0604 as
six hundred four days after Jan 1, 1900.

If the cell is fomatted to show the date as YYMM, then the number 0604
returns a date of 0108, or August of 1901.

Is there any way to make Excel see an entered string of numbers as a
previously formatted date?

Thanks for any help
 
But to do that you need to have a day in April to compare with today's date?

If we assume that day is the 1st

=TODAY()>--TEXT(REPT("0",4-LEN(A1))&A1&"01","\2\000-00-00")


--

Regards,

Peo Sjoblom

http://nwexcelsolutions.com
 
Back
Top