Thread: Date Format
View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default Date Format

On Tue, 7 Aug 2012 12:30:26 -0700, "joeu2004" wrote:

"Ron Rosenfeld" wrote:
As joeu as pointed out, this is a difficult problem. Here is another
solution:

[....]
=--(RIGHT(A1,3) &" 1, " &LEFT(A1,FIND("-",A1)-1)+2000)


Well, if we're going to make the assumption that all dates are in the year
2000 or later, it is not difficult at all to provide a region-independent
solution.

Since we're making unsubstantiated assumptions, let's assume the dates are
in the years 2001 through 2028.

Then the following should work, assuming that yy-mmm data are already input
and interpreted as dd-mmm of the current year (i.e. numeric Excel dates; the
display format does not matter).

Enter the following formula into X1 and copy down through X1000:

=DATE(2000+DAY(A1),MONTH(A1),1)

Copy X1:X1000 and use paste-special-value to overwrite A1:A1000. Delete
X1:X1000. Format A1:A1000 any way you wish.


Excellent point, given the assumption of year being 2001-2028.

On the other hand, if the 2-digit year should be interpreted as any other 2-digit year being entered with the current default settings for Windows of being interpreted as being 1930-2029, then one could modify my text import method to use the formula:

=--(RIGHT(A1,3)&" 1, "&LEFT(A1,FIND("-",A1)-1)+2000-100*(--LEFT(A1,FIND("-",A1)-1)29))