View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Format 2 digit year to 4 digit

On Wed, 13 Dec 2006 11:15:00 -0800, RealGomer
wrote:

The last pair of numbers are the year in 2 digit format. After I convert the
text string to columns using Date Text to Columns Delimited or Fixed
Width, I want to format the resulting 2 digit years to 4 digit. Using the
above account number as an example, the function result would be:
10000003 001 001 06 04

and I want it to format as:
10000003 001 001 2006 2004.


I note you write you want to "format" the value, not "change" the value.

To format the cell so it will show appropriate four digit date:

Format/Cells/Number/Custom Type: [30]"19"00;"20"00

If the two digit year is 30, the cell will show 19xx ; if <=30, then the cell
will show 20xx.

So your 4 will show as 2004.

If you want to actually change the value, then you need a function:

=A1+1900+100*(A1<=30)

Substitute the cell where your two year value is for A1.
--ron