+ Reply to Thread
Results 1 to 9 of 9

Convert Text Times for calculations

  1. #1
    Forum Contributor
    Join Date
    11-27-2009
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2013 & 2016
    Posts
    409

    Convert Text Times for calculations

    Hello,

    Our system throws out start and Stop times as text, I want to perform calculations, how can I convert in excel?

    So, Start Time is in this format =" 9:10" which means 9:10am
    and Stop Time is in this format =" 2:00" which means 2:00pm

    I want this format 00:00:00 Hrs/Mins/Secs so I can calculate the elapsed time.

    I have tried reformat the cell with little luck.

    Thanks
    ==========
    Bigroo1958
    Austin, Texas
    ==========

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,544

    Re: Convert Text Times for calculations

    If " 9:10" is 9:10 am and " 2:00" is 2:00 pm then what are 9:00 pm and 2:00 am?

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Convert Text Times for calculations

    With your sample values in A1 and B1

    This formula returns the time value of A1
    C1: =--TRIM(A1)

    and this formula returns the time value of B1.
    Note: because the values don't indicate if they're AM or PM, if the B1 time is prior to C1, it adds 12 hours.
    D1: =--TRIM(B1)+IF(--TRIM(B1)<C1,TIME(12,,),0)

    Format C1:D1 as time.




    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Forum Contributor
    Join Date
    11-27-2009
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2013 & 2016
    Posts
    409

    Re: Convert Text Times for calculations

    Hi Ron Coderre,

    Yes, this works out nicely indeed!!
    Thanks

  5. #5
    Forum Contributor
    Join Date
    11-27-2009
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2013 & 2016
    Posts
    409

    Re: Convert Text Times for calculations

    Hi Ron Coderre,

    I think I jumped the gun with this, please review the attachment, I see an issue with the elapsed times.
    All sensitive information has been removed.

    Please advise how to correct this, thanks
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    11-15-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    538

    Re: Convert Text Times for calculations

    You still need to address JeteMC's AM/PM concern, but try
    =TIMEVALUE(A1)
    and optionally format that as time. That works for a cell with exact formula
    A1=" 9:10"
    as well as a copy of that by value.

    Formatting is actually not needed for elapsed time calculation; the date values are subtractable either way. However I understand that you want it shown on the result of elapsed time, so you can format that as 0:00:00.

    If A2=" 9:20" then timevalue(a2)-timevalue(a1) gives 0:10:00

    Note you can go 86400*(timevalue(a2)-timevalue(a1)) for total number of seconds, handy in some time subtraction (elapsed) applications.

    Special consideration is called for if the span of your start and stop times may cross midnight.

    BTW I did not look at your attachment.
    Chip, if you can read this, you're STILL making the world a better place with your immeasurably valuable gifts. Every week, you continue to help me (and untold numbers of others) tremendously. Practically no alternative outlets can match your effectiveness, even over the vast number of topics you demystify and empower usage of. You were, and still are, amazing.

  7. #7
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Convert Text Times for calculations

    Thank you for the example.
    The formulas in Col_AD should be checking if the converted Col_H time is less than the converted Col_G time....in Col_AC, not Col_G

    Use this formula and copy it down as far as you need
    Please Login or Register  to view this content.
    Not this:
    Please Login or Register  to view this content.
    Does that help?

  8. #8
    Forum Contributor
    Join Date
    11-27-2009
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2013 & 2016
    Posts
    409

    Re: Convert Text Times for calculations

    Thanks Ron, Wow I did not see that mistake on my behalf, works nicely now.
    A simple typo!!

    Thanks

  9. #9
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Convert Text Times for calculations

    Glad you got something you can use!

    If that resolves your issue, please take a moment to mark this thread as SOLVED (from the Thread Tools menu)

+ 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] Conditional times calculations
    By Khaldon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-16-2015, 05:49 AM
  2. Overtime calculations / times
    By frazzled in forum Excel General
    Replies: 6
    Last Post: 03-01-2011, 06:35 AM
  3. Calculations with Dates/Times
    By soma104 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-20-2010, 02:05 PM
  4. [SOLVED] Difference in dates calculations except between certain times.
    By Steve Hud in forum Excel General
    Replies: 1
    Last Post: 01-13-2006, 09:15 AM
  5. [SOLVED] 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