Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron Ron is offline
external usenet poster
 
Posts: 250
Default Anaother time format question

I get text files from a phone switch. I then have a macro that does some
calculations and saves it as 2003 format .xls. I am using 2007.

The times come across like: 8:48, which is actually 8:48:00 AM. However,
some come across as :53, which stores as :53. I need it to be in the format
of 12:53:00 AM, for calculations. If I manually put a 0 in front, 0:53, it
stores fine, but I do not want to manually do this on hundreds of files,
hundreds of entries every month. The concatenate into a different cell, saves
it as text, so no calculations there.

Is there VB formula that will change :53 to 12:53:00 AM which can be run on
the whole file, changing only those that are less than a minute? If it can do
it in the same cell, all the better, but if not, that's ok, too.

Thanks,
Ron

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Anaother time format question

Assuming A2 contains your "time" entry, put this in another cell...

=--("0"&A2)

and format that cell as Time (picking whichever time format you want).

--
Rick (MVP - Excel)


"Ron" wrote in message
...
I get text files from a phone switch. I then have a macro that does some
calculations and saves it as 2003 format .xls. I am using 2007.

The times come across like: 8:48, which is actually 8:48:00 AM. However,
some come across as :53, which stores as :53. I need it to be in the
format
of 12:53:00 AM, for calculations. If I manually put a 0 in front, 0:53, it
stores fine, but I do not want to manually do this on hundreds of files,
hundreds of entries every month. The concatenate into a different cell,
saves
it as text, so no calculations there.

Is there VB formula that will change :53 to 12:53:00 AM which can be run
on
the whole file, changing only those that are less than a minute? If it can
do
it in the same cell, all the better, but if not, that's ok, too.

Thanks,
Ron


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Anaother time format question

Assuming A2 contains your "time" entry, put this in another cell...

=--("0"&A2)

and format that cell as Time (picking whichever time format you want).

--
Rick (MVP - Excel)


"Ron" wrote in message
...
I get text files from a phone switch. I then have a macro that does some
calculations and saves it as 2003 format .xls. I am using 2007.

The times come across like: 8:48, which is actually 8:48:00 AM. However,
some come across as :53, which stores as :53. I need it to be in the
format
of 12:53:00 AM, for calculations. If I manually put a 0 in front, 0:53, it
stores fine, but I do not want to manually do this on hundreds of files,
hundreds of entries every month. The concatenate into a different cell,
saves
it as text, so no calculations there.

Is there VB formula that will change :53 to 12:53:00 AM which can be run
on
the whole file, changing only those that are less than a minute? If it can
do
it in the same cell, all the better, but if not, that's ok, too.

Thanks,
Ron


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Anaother time format question

Ron

Try the below macro. Select the range of cells with time. and run...


Sub Macro()
Dim cell As Range
For Each cell In Selection
If Left(cell.Value, 1) = ":" Then
cell.Value = "00:" & Mid(cell.Value, 2)
End If
Next
End Sub
--
If this post helps click Yes
---------------
Jacob Skaria


"Ron" wrote:

I get text files from a phone switch. I then have a macro that does some
calculations and saves it as 2003 format .xls. I am using 2007.

The times come across like: 8:48, which is actually 8:48:00 AM. However,
some come across as :53, which stores as :53. I need it to be in the format
of 12:53:00 AM, for calculations. If I manually put a 0 in front, 0:53, it
stores fine, but I do not want to manually do this on hundreds of files,
hundreds of entries every month. The concatenate into a different cell, saves
it as text, so no calculations there.

Is there VB formula that will change :53 to 12:53:00 AM which can be run on
the whole file, changing only those that are less than a minute? If it can do
it in the same cell, all the better, but if not, that's ok, too.

Thanks,
Ron

  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron Ron is offline
external usenet poster
 
Posts: 250
Default Anaother time format question

Jacob,

That worked like a charm. The time is stored perfectly.
I used your solution as it kept the time in the same cell.

Thanks to Rick also.

Ron

"Jacob Skaria" wrote:

Ron

Try the below macro. Select the range of cells with time. and run...


Sub Macro()
Dim cell As Range
For Each cell In Selection
If Left(cell.Value, 1) = ":" Then
cell.Value = "00:" & Mid(cell.Value, 2)
End If
Next
End Sub
--
If this post helps click Yes
---------------
Jacob Skaria


"Ron" wrote:

I get text files from a phone switch. I then have a macro that does some
calculations and saves it as 2003 format .xls. I am using 2007.

The times come across like: 8:48, which is actually 8:48:00 AM. However,
some come across as :53, which stores as :53. I need it to be in the format
of 12:53:00 AM, for calculations. If I manually put a 0 in front, 0:53, it
stores fine, but I do not want to manually do this on hundreds of files,
hundreds of entries every month. The concatenate into a different cell, saves
it as text, so no calculations there.

Is there VB formula that will change :53 to 12:53:00 AM which can be run on
the whole file, changing only those that are less than a minute? If it can do
it in the same cell, all the better, but if not, that's ok, too.

Thanks,
Ron



  #6   Report Post  
Posted to microsoft.public.excel.programming
Ron Ron is offline
external usenet poster
 
Posts: 250
Default Anaother time format question

Jacob,

That worked like a charm. The time is stored perfectly.
I used your solution as it kept the time in the same cell.

Thanks to Rick also.

Ron

"Jacob Skaria" wrote:

Ron

Try the below macro. Select the range of cells with time. and run...


Sub Macro()
Dim cell As Range
For Each cell In Selection
If Left(cell.Value, 1) = ":" Then
cell.Value = "00:" & Mid(cell.Value, 2)
End If
Next
End Sub
--
If this post helps click Yes
---------------
Jacob Skaria


"Ron" wrote:

I get text files from a phone switch. I then have a macro that does some
calculations and saves it as 2003 format .xls. I am using 2007.

The times come across like: 8:48, which is actually 8:48:00 AM. However,
some come across as :53, which stores as :53. I need it to be in the format
of 12:53:00 AM, for calculations. If I manually put a 0 in front, 0:53, it
stores fine, but I do not want to manually do this on hundreds of files,
hundreds of entries every month. The concatenate into a different cell, saves
it as text, so no calculations there.

Is there VB formula that will change :53 to 12:53:00 AM which can be run on
the whole file, changing only those that are less than a minute? If it can do
it in the same cell, all the better, but if not, that's ok, too.

Thanks,
Ron

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
Time Format Question Toria Excel Worksheet Functions 6 May 13th 10 05:11 AM
Date time format question please ferde Excel Discussion (Misc queries) 7 August 20th 07 06:00 PM
One more question pay calcs using [h]:mm format for time worke Rufus Excel Discussion (Misc queries) 4 July 25th 07 10:10 PM
Time Format Input question WinterCoast[_4_] Excel Programming 3 July 13th 05 01:18 AM
Time Format Question C A Excel Worksheet Functions 1 July 5th 05 06:38 PM


All times are GMT +1. The time now is 12:00 AM.

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"