+ Reply to Thread
Results 1 to 6 of 6

Convert Text to Time

Hybrid View

  1. #1
    Registered User
    Join Date
    07-03-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    16

    Convert Text to Time

    Hi friends,

    I have an excel file here. The columns have timings which is in the format '00:00'. When I try to get a total of them, it is taking them as text and not giving the sum.
    I added a zero in front and had to press F2 and then Enter, then only I am getting the summation. Since the data is large, can anyone help me find a solution that I do not have to press F2 and then Enter to each cell.

    I have attached the file here.

    Regards,
    Ujjwal Jha
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,051

    Re: Convert Text to Time

    Hi and welcome to the forum

    This will work for most of your data but not all.

    Highlight your range (for instance E3:F852) and press CTRL H (Find/Replace)
    Find :00:
    Replace 00:

    If you look at your data, you will see that some is left justified and some right. The right justified is (generally) numeric and left is (generally) text, so it will be easy to see which cells still need adjusting. E23 for instance will need to be manually adjusted - unless you have a lot of cells that you can use :23: on

    Let me know how you make out?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    07-03-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    16

    Re: Convert Text to Time

    Thanks Friend. But the real problem is as you can see, the data to be changed manually is too big. I have to make changes in almost all the columns which is in format of :xx:xx.

    Regards,
    Ujjwal

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Convert Text to Time

    You may try this code to see if this helps......
    Sub replace()
    Dim cell As Range
    Application.ScreenUpdating = False
    For Each cell In ActiveSheet.UsedRange
        cell.Select
        If Left(cell, 1) = ":" Then
        cell = 0 & cell
        End If
    Next cell
    Application.ScreenUpdating = True
    End Sub
    To apply the code on the sheet...

    Press Alt+F11 to open VBA Editor --> Insert --> Module --> Paste the above code in the code window --> Press F9 to run the code --> Save your workbook as Excel Macro-Enabled Workbook.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  5. #5
    Registered User
    Join Date
    07-03-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    16

    Re: Convert Text to Time

    I think it worked. Great!!!
    Thanks a lot for your time and help. Really happy to join this forum.

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Convert Text to Time

    You're welcome. Thanks for the feedback.
    If that takes care of your question, please mark your thread as Solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.
    Moreover you may also click on * (star) to Add Reputation to those who have put their time and efforts to help you in this forum. This is another way to say thanks to them.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Convert text to time
    By namluke in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 03-05-2014, 08:07 PM
  2. [SOLVED] convert text to time
    By SRSnyder in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-04-2013, 03:22 PM
  3. Time stored as text. How can I convert to data and time?
    By matthewbutterworth in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-07-2013, 10:19 AM
  4. Convert Text to time
    By Grimace in forum Excel General
    Replies: 10
    Last Post: 07-13-2010, 06:37 PM
  5. convert time imported as text to time format for calculations
    By batfish in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-27-2005, 07:05 PM

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