close

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 helpBut 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()gt;--TEXT(REPT(quot;0quot;,4-LEN(A1))amp;A1amp;quot;01quot;,quot;\2\000-00-00quot;)--

Regards,

Peo Sjoblom

nwexcelsolutions.com
quot;michaelberrierquot; gt; wrote in message oups.com...
gt;I am using a magnetic stripe reader to enter a DL expiration date into
gt; a cell. The date on the stripe is formatted as YYMM, so April of 2006
gt; would look like 0604. The trouble comes when I want to compare that
gt; date to today's to automatically detect an expired document.
gt;
gt; Excel will allow a date in that format as long as it is entered that
gt; way to start with. Otherwise, Excel will interpret the number 0604 as
gt; six hundred four days after Jan 1, 1900.
gt;
gt; If the cell is fomatted to show the date as YYMM, then the number 0604
gt; returns a date of 0108, or August of 1901.
gt;
gt; Is there any way to make Excel see an entered string of numbers as a
gt; previously formatted date?
gt;
gt; Thanks for any help
gt;
That looks like it works. Do you mind telling me how?

thanks
mb

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()