Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Date Problem

I have a spreadsheet with data generated by another program. There is one
column with dates in this format: 04-May-05. From what I can tell, Excel is
treat this as a string, not a date.

Next to this column, I use the following formula to convert a date such as
04-May-05 into 04-09-05 (this new column is formatted as yy-mm-dd).

=DATE(RIGHT(D2,2),LOOKUP(MID(D2,4,3),Table!$A$1:$B $12),LEFT(D2,2))

The lookup is for changing Jan into 01, Feb into 02, etc.

PROBLEM:

When I do a pivot table with the column, a date such as 04-May-05 appears
as 1904-09-05, rather than 2004-09-05. What should I do to make sure that
the years are 20xx and not 19xx?

In fact, is there a better way to do the date conversion? My method seems
rather clumsy.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Date Problem

Have you tried using the DateValue() function. It takes a single argument
that is a string and (if it can) converts it to a date... So if your string
is in call A1 the in another cell add the formula =datevalue(A1)
--
HTH...

Jim Thomlinson


"Shatin" wrote:

I have a spreadsheet with data generated by another program. There is one
column with dates in this format: 04-May-05. From what I can tell, Excel is
treat this as a string, not a date.

Next to this column, I use the following formula to convert a date such as
04-May-05 into 04-09-05 (this new column is formatted as yy-mm-dd).

=DATE(RIGHT(D2,2),LOOKUP(MID(D2,4,3),Table!$A$1:$B $12),LEFT(D2,2))

The lookup is for changing Jan into 01, Feb into 02, etc.

PROBLEM:

When I do a pivot table with the column, a date such as 04-May-05 appears
as 1904-09-05, rather than 2004-09-05. What should I do to make sure that
the years are 20xx and not 19xx?

In fact, is there a better way to do the date conversion? My method seems
rather clumsy.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Date Problem

Try using:

=DATE(20 & RIGHT(D2,2),LOOKUP(MID(D2,4,3),Table!$A$1:$B$12),L EFT(D2,2))

If I have amended your formula correct you should not be passing 2005 rather
than 05 as the year, thus taking out any ambiguity.



"Shatin" wrote in message
...
I have a spreadsheet with data generated by another program. There is one
column with dates in this format: 04-May-05. From what I can tell, Excel
is
treat this as a string, not a date.

Next to this column, I use the following formula to convert a date such as
04-May-05 into 04-09-05 (this new column is formatted as yy-mm-dd).

=DATE(RIGHT(D2,2),LOOKUP(MID(D2,4,3),Table!$A$1:$B $12),LEFT(D2,2))

The lookup is for changing Jan into 01, Feb into 02, etc.

PROBLEM:

When I do a pivot table with the column, a date such as 04-May-05 appears
as 1904-09-05, rather than 2004-09-05. What should I do to make sure that
the years are 20xx and not 19xx?

In fact, is there a better way to do the date conversion? My method seems
rather clumsy.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Date Problem

Yes, DateValue() works fine! In fact, I did try DateValue initially. What I
got was number. I forgot that I needed to format it into a date format and
so thought it didn't work. Now everything is OK. Thanks!


"Jim Thomlinson" wrote in message
...
Have you tried using the DateValue() function. It takes a single argument
that is a string and (if it can) converts it to a date... So if your

string
is in call A1 the in another cell add the formula =datevalue(A1)
--
HTH...

Jim Thomlinson


"Shatin" wrote:

I have a spreadsheet with data generated by another program. There is

one
column with dates in this format: 04-May-05. From what I can tell, Excel

is
treat this as a string, not a date.

Next to this column, I use the following formula to convert a date such

as
04-May-05 into 04-09-05 (this new column is formatted as yy-mm-dd).

=DATE(RIGHT(D2,2),LOOKUP(MID(D2,4,3),Table!$A$1:$B $12),LEFT(D2,2))

The lookup is for changing Jan into 01, Feb into 02, etc.

PROBLEM:

When I do a pivot table with the column, a date such as 04-May-05

appears
as 1904-09-05, rather than 2004-09-05. What should I do to make sure

that
the years are 20xx and not 19xx?

In fact, is there a better way to do the date conversion? My method

seems
rather clumsy.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exel increment date problem wrt todays date. [email protected] Excel Worksheet Functions 1 November 11th 07 06:58 PM
Date Formula Problem - Leave date blank if Null Gayla Excel Worksheet Functions 5 April 24th 07 09:42 PM
Date problem ehale Excel Worksheet Functions 3 November 28th 06 05:24 PM
Date problem! liamsdad Excel Discussion (Misc queries) 3 June 17th 06 02:27 AM
Date Problem Edgar[_3_] Excel Programming 1 February 17th 04 03:16 PM


All times are GMT +1. The time now is 08:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"