+ Reply to Thread
Results 1 to 12 of 12

Need help with a formula that converts times listed using data verification into hours.

  1. #1
    Registered User
    Join Date
    02-22-2017
    Location
    Gerogia, USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Need help with a formula that converts times listed using data verification into hours.

    Need help with a formula that converts times listed using data verification into hours. For example 2pm - 10pm = 8 hrs. The formula I'm currently using works fine until the times run past 12pm. Then it creates an error because it generates a negative number. =IFERROR(IF(D75<C75,(24*D75-C75),IFERROR(D75-C75,"")),"") Where D75 is 11:30pm and C75 is 2:30pm the formula generates the result of 9:00 which is correct. But if D75 is changed to 12:00am it generates and error because the result is a negative number.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need help with a formula that converts times listed using data verification into hours

    Maybe:

    =((D75-C75)+(D75<C75))*24



    Better:

    =IF(COUNT(C75:D75)=2, ((D75-C75)+(D75<C75))*24, "")
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    02-22-2017
    Location
    Gerogia, USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Need help with a formula that converts times listed using data verification into hours

    Thank you for your help. But this returns a result of 0:00.

  4. #4
    Registered User
    Join Date
    02-22-2017
    Location
    Gerogia, USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Need help with a formula that converts times listed using data verification into hours

    Would you be willing to look at the workbook?

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,245

    Re: Need help with a formula that converts times listed using data verification into hours

    Yes ... it helps if there is data work with.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need help with a formula that converts times listed using data verification into hours

    Sure. Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  7. #7
    Registered User
    Join Date
    02-22-2017
    Location
    Gerogia, USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Need help with a formula that converts times listed using data verification into hours

    How can I send the workbook?

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need help with a formula that converts times listed using data verification into hours

    Read post #6.

  9. #9
    Registered User
    Join Date
    02-22-2017
    Location
    Gerogia, USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Need help with a formula that converts times listed using data verification into hours

    Here's the work book. It is a scheduleing tool that is suppost to calculate hours scheduled vs. hours forecasted.
    It works fine until one of the times selected goes beyond 12am, it then creates an error because the result is a negative number.
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,245

    Re: Need help with a formula that converts times listed using data verification into hours

    Try

    =IFERROR(D75-C75+(D75<C75),"")

  11. #11
    Registered User
    Join Date
    02-22-2017
    Location
    Gerogia, USA
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Need help with a formula that converts times listed using data verification into hours

    Thanks that works. Much Appreciated!!!

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,245

    Re: Need help with a formula that converts times listed using data verification into hours

    Thanks for the feedback and rep.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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] Formula for hours between two times
    By nagesh.tvsr in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 06-19-2015, 07:13 AM
  2. Replies: 4
    Last Post: 03-31-2015, 11:40 AM
  3. [SOLVED] Formula to work out hours between 2 dates and times.. MINUS Out Of Hours
    By chris.m in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-30-2012, 08:11 AM
  4. Copy rows of data to another worksheet - only - if listed several times
    By Kasperlindoe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-09-2010, 10:41 AM
  5. Replies: 4
    Last Post: 04-19-2009, 06:13 PM
  6. How many times is a name listed
    By sabegirl in forum Excel General
    Replies: 4
    Last Post: 06-18-2006, 03:42 AM
  7. Delete rows listed less than 8 times???
    By anilos81 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 11-10-2005, 12:29 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