#1   Report Post  
Posted to microsoft.public.excel.misc
DA DA is offline
external usenet poster
 
Posts: 104
Default Convert to hrs:min

hello
Is there any way to convert the following numbers to show as hrs:min without
manually insterting a colon?
e.g.15:45 18:40

1545 1840
2015 2300
2045 2105
1700 1815
1825 1840
1850 2000
1835 1900

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Convert to hrs:min

Select the cells you want to convert and run this little macro:

Sub marine()
Dim hrs As Integer, mins As Integer
For Each r In Selection
v = r.Value
hrs = Left(v, 2)
mins = Right(v, 2)
r.Clear
r.NumberFormat = "hh:mm"
r.Value = TimeSerial(hrs, mins, 0)
Next
End Sub

--
Gary''s Student - gsnu201003


"da" wrote:

hello
Is there any way to convert the following numbers to show as hrs:min without
manually insterting a colon?
e.g.15:45 18:40

1545 1840
2015 2300
2045 2105
1700 1815
1825 1840
1850 2000
1835 1900

  #3   Report Post  
Posted to microsoft.public.excel.misc
DA DA is offline
external usenet poster
 
Posts: 104
Default Convert to hrs:min

Thank you for your suggestion. I am not good at runnung macros.
But I found another formula that worked.

"Gary''s Student" wrote:

Select the cells you want to convert and run this little macro:

Sub marine()
Dim hrs As Integer, mins As Integer
For Each r In Selection
v = r.Value
hrs = Left(v, 2)
mins = Right(v, 2)
r.Clear
r.NumberFormat = "hh:mm"
r.Value = TimeSerial(hrs, mins, 0)
Next
End Sub

--
Gary''s Student - gsnu201003


"da" wrote:

hello
Is there any way to convert the following numbers to show as hrs:min without
manually insterting a colon?
e.g.15:45 18:40

1545 1840
2015 2300
2045 2105
1700 1815
1825 1840
1850 2000
1835 1900

  #4   Report Post  
Senior Member
 
Location: Philippines
Posts: 161
Default

Quote:
Originally Posted by da View Post
hello
Is there any way to convert the following numbers to show as hrs:min without
manually insterting a colon?
e.g.15:45 18:40

1545 1840
2015 2300
2045 2105
1700 1815
1825 1840
1850 2000
1835 1900
If A1 has 1545
=(Left(A1,2)&":"&Right(A1,2))*1

Then format the cell as Time with 13:30 format
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
can the "convert" function in excel convert to UK gallons? JR Excel Discussion (Misc queries) 2 April 24th 08 04:55 PM
how will i convert 05.01.2007 convert 05.Jan.2007 format? lady_like New Users to Excel 17 February 9th 07 12:43 PM
convert value in word. For Exampe Rs.115.00 convert into word as . Shakti Excel Discussion (Misc queries) 1 May 10th 05 12:00 PM
convert decimal number to time : convert 1,59 (minutes, dec) to m agenda9533 Excel Discussion (Misc queries) 8 January 20th 05 10:24 PM
Convert Time...!convert tenths of a second Pape Excel Discussion (Misc queries) 2 December 16th 04 10:17 AM


All times are GMT +1. The time now is 11:26 PM.

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

About Us

"It's about Microsoft Excel"