+ Reply to Thread
Results 1 to 7 of 7

convert time without using a semi colon

  1. #1
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    convert time without using a semi colon

    Guys

    having trouble with inputting a time...when i put in 230303 in cell A1 i want it to read 23:03:03 but unfortunatly i get a date and time when i format the cell to hh:mm:ss

    any ideas

    cheers
    Attached Files Attached Files
    Last edited by daznav; 07-22-2010 at 10:39 PM.

  2. #2
    Registered User
    Join Date
    07-15-2010
    Location
    Daegu, Korea
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: convert time without using a semi colon

    Put in number in column Z(or any...outside of data range)
    A1 : =TIMEVALUE(TEXT(Z1,"00"":""00"":""00"))
    Hide column Z

  3. #3
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: convert time without using a semi colon

    Sorry but what number in colum z i need cell A1 blank to start with so i can input 230303 what does the number in Z signify

  4. #4
    Registered User
    Join Date
    07-15-2010
    Location
    Daegu, Korea
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: convert time without using a semi colon

    Put in Sheet1 module


    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim X As String

    With Target
    If .Count > 1 Then Exit Sub
    If .Column = 1 Then
    X = .Value
    Application.EnableEvents = False
    If Len(X) < 6 Then
    X = "0" & X
    End If
    .Value = TimeSerial(Left(X, 2), Mid(X, 3, 2), Right(X, 2))
    End If
    Application.EnableEvents = True
    End With
    End Sub

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: convert time without using a semi colon

    rethguals,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  6. #6
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: convert time without using a semi colon

    Thank you it does work but also found a custom format thanks again

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: convert time without using a semi colon

    For the benefit of others - the Custom Format would be: 00\:00\:00

    However the above is merely a mask, the underlying value remains unaffected and is thus not converted to Time.

    If you conduct further calcs on this data you must remember to account for this, eg if you had multiple entries in A1:A10 and wished to SUM the cumulative time you could use:

    =SUMPRODUCT(--TEXT(A1:A10,"00\:00\:00"))
    format as [hh]:mm:ss

    (ie result would be a time value)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1