PC Review


Reply
Thread Tools Rate Thread

Convert Date-as-Text

 
 
Fred Holmes
Guest
Posts: n/a
 
      13th Mar 2010
Using Excel 2000

I have an Excel worksheet (.xls) that was produced by an accountant
exporting data from a particular accounting package. There is a colum
of dates of the m/d/yyyy format that don't sort as dates. They sort
alphabetically, which is of no use.

I'm looking for the VBA function that will convert text in the
m/d/yyyy format to an Excel date number.

Cells(n, m).formula = DateConverter(Cells(n, m).value)

or some such

And I will then write a loop macro to process each cell in the
column/range to convert the cell contents to an Excel date of the
usual kind that will sort properly.

A search in the Excel VBA help on "date" doesn't yield anything
interesting, and I can't think of a good search keyword for this.

I have no idea how this circumstance occurred, but I don't want to
bother the accountant about it. I have downloaded a lot of banking
and credit card stuff in .csv file format, opened it in Excel, and
saved it as an .xls and have always (usually?) gotten proper Excel
dates to appear in the cells in the date column.

Many thanks,

Fred Holms
 
Reply With Quote
 
 
 
 
Dennis Tucker
Guest
Posts: n/a
 
      13th Mar 2010
Does the normal "Format Cells..." not work?



"Fred Holmes" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Using Excel 2000
>
> I have an Excel worksheet (.xls) that was produced by an accountant
> exporting data from a particular accounting package. There is a colum
> of dates of the m/d/yyyy format that don't sort as dates. They sort
> alphabetically, which is of no use.
>
> I'm looking for the VBA function that will convert text in the
> m/d/yyyy format to an Excel date number.
>
> Cells(n, m).formula = DateConverter(Cells(n, m).value)
>
> or some such
>
> And I will then write a loop macro to process each cell in the
> column/range to convert the cell contents to an Excel date of the
> usual kind that will sort properly.
>
> A search in the Excel VBA help on "date" doesn't yield anything
> interesting, and I can't think of a good search keyword for this.
>
> I have no idea how this circumstance occurred, but I don't want to
> bother the accountant about it. I have downloaded a lot of banking
> and credit card stuff in .csv file format, opened it in Excel, and
> saved it as an .xls and have always (usually?) gotten proper Excel
> dates to appear in the cells in the date column.
>
> Many thanks,
>
> Fred Holms


 
Reply With Quote
 
Fred Holmes
Guest
Posts: n/a
 
      13th Mar 2010
Formatting the cells as date, e.g., mm/dd/yyyy doesn't make the cells
sort properly and doesn't change the way the dates are displayed.
They appear to be fixed text.

Fred Holmes

On Sat, 13 Mar 2010 15:10:38 -0700, "Dennis Tucker"
<(E-Mail Removed)> wrote:

>Does the normal "Format Cells..." not work?
>
>
>
>"Fred Holmes" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> Using Excel 2000
>>
>> I have an Excel worksheet (.xls) that was produced by an accountant
>> exporting data from a particular accounting package. There is a colum
>> of dates of the m/d/yyyy format that don't sort as dates. They sort
>> alphabetically, which is of no use.
>>
>> I'm looking for the VBA function that will convert text in the
>> m/d/yyyy format to an Excel date number.
>>
>> Cells(n, m).formula = DateConverter(Cells(n, m).value)
>>
>> or some such
>>
>> And I will then write a loop macro to process each cell in the
>> column/range to convert the cell contents to an Excel date of the
>> usual kind that will sort properly.
>>
>> A search in the Excel VBA help on "date" doesn't yield anything
>> interesting, and I can't think of a good search keyword for this.
>>
>> I have no idea how this circumstance occurred, but I don't want to
>> bother the accountant about it. I have downloaded a lot of banking
>> and credit card stuff in .csv file format, opened it in Excel, and
>> saved it as an .xls and have always (usually?) gotten proper Excel
>> dates to appear in the cells in the date column.
>>
>> Many thanks,
>>
>> Fred Holms


 
Reply With Quote
 
Fred Holmes
Guest
Posts: n/a
 
      14th Mar 2010
While formatting the cells didn't work directly, I thought about it
some more after your question, and the following worked:

cells(n, m).formula = cells(n, m).value

After processing the column with the above, formatting does work and
stuff sorts.

Fred Holmes

On Sat, 13 Mar 2010 15:10:38 -0700, "Dennis Tucker"
<(E-Mail Removed)> wrote:

>Does the normal "Format Cells..." not work?
>
>
>
>"Fred Holmes" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> Using Excel 2000
>>
>> I have an Excel worksheet (.xls) that was produced by an accountant
>> exporting data from a particular accounting package. There is a colum
>> of dates of the m/d/yyyy format that don't sort as dates. They sort
>> alphabetically, which is of no use.
>>
>> I'm looking for the VBA function that will convert text in the
>> m/d/yyyy format to an Excel date number.
>>
>> Cells(n, m).formula = DateConverter(Cells(n, m).value)
>>
>> or some such
>>
>> And I will then write a loop macro to process each cell in the
>> column/range to convert the cell contents to an Excel date of the
>> usual kind that will sort properly.
>>
>> A search in the Excel VBA help on "date" doesn't yield anything
>> interesting, and I can't think of a good search keyword for this.
>>
>> I have no idea how this circumstance occurred, but I don't want to
>> bother the accountant about it. I have downloaded a lot of banking
>> and credit card stuff in .csv file format, opened it in Excel, and
>> saved it as an .xls and have always (usually?) gotten proper Excel
>> dates to appear in the cells in the date column.
>>
>> Many thanks,
>>
>> Fred Holms


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert date (m/dd/yyyy) in text format into an excel recognised date Rob P Microsoft Excel Programming 3 30th Apr 2010 12:40 AM
how do i convert text to date (mm/yy text to mm/dd/yyyy date)? =?Utf-8?B?bGluZHNleQ==?= Microsoft Excel Misc 1 27th Jul 2007 10:05 PM
VBA convert day and date from text string to Excel date Max Bialystock Microsoft Excel Programming 5 14th May 2007 04:54 AM
Help: How do I convert a text date into a real date format japorms Microsoft Excel Worksheet Functions 4 2nd Aug 2006 06:36 PM
How to Convert Days(Text field) into Date By giving the start date FA Microsoft Access Forms 3 2nd Dec 2005 08:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:44 AM.