+ Reply to Thread
Results 1 to 13 of 13

Sum of 09:00 - 17:00 etc

  1. #1
    Registered User
    Join Date
    06-24-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    6

    Sum of 09:00 - 17:00 etc

    Hi

    Apologies as I'm sure this is an easy solution:

    I'm trying to calculate the amount of hours worked in the following ranges. for example

    A1 = 09:00 - 17:00 (8h)
    B1 = 08:00 - 15:00 (7h)
    C1 = 08:00 - 14:00 (6h)
    D1 = 08:00 - 18:00 (10h)
    E1 = 17:00 - 21:00 (4h)
    F1 = 22:00 - 08:00 (10h)
    G1 = 08:00 - 15:00 (7h)

    How would I add a formula that displays the resulting hours from all the range? So that the cell containing the formula would display 50.

    Plenty of trial and error and googling.. I'm sure I'm missing something.

    Cheers

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Sum of 09:00 - 17:00 etc

    =SUM(A1:G1) and format the cell to custom [h]:mm
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sum of 09:00 - 17:00 etc

    Or
    =SUM(A1:G1)*24
    Format the cell as a Number, not time.

  4. #4
    Registered User
    Join Date
    06-24-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    6

    Re: Sum of 09:00 - 17:00 etc

    Both of these return zero as the answer.

    Have formatted both as [h]:mm & as Number and both return 0.00 using either formula.
    Last edited by Adam7958; 06-24-2015 at 02:56 PM.

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sum of 09:00 - 17:00 etc

    Sounds like the values in A1:G1 are not really time values, just text strings.

    Can you post a sample book (an XL Book, not a picture)?
    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  6. #6
    Registered User
    Join Date
    06-24-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    6

    Re: Sum of 09:00 - 17:00 etc

    Yes they're text values sorry, essentially needing the value assigned to them. I can't upload at work currently. Will do ASAP.

    The shifts (eg 09:00 - 17:00) are just taken from a table and populated with data validation pulled from VLOOKUP.

    Is there a way to assign a value to each text string(e.g. 09:00 - 17:00 = 8) easily?

    Will upload when I can tomorrow AM.

    Thanks.

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sum of 09:00 - 17:00 etc

    Can you give some examples of what 'Exactly' is in the cells?

  8. #8
    Registered User
    Join Date
    06-24-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    6

    Re: Sum of 09:00 - 17:00 etc

    "09:00 - 17:00"
    "08:00 - 15:00"
    "08:00 - 14:00"

    And so on.

    Thanks for the patience, sorry.

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sum of 09:00 - 17:00 etc

    Try

    =SUMPRODUCT(MOD((1+RIGHT("00000"&A1:G1,5))-LEFT(A1:G1&"00000",5),1))
    Formatted as time [hh]:mm

    or add *24 to the end and format as a number.

  10. #10
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,367

    Re: Sum of 09:00 - 17:00 etc

    Another approach
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-24-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    6

    Re: Sum of 09:00 - 17:00 etc

    No luck. Returns as #VALUE! even when formatting the cell.

    See attached - to SUM I7:O7 & show the value in AK.
    Attached Images Attached Images

  12. #12
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Sum of 09:00 - 17:00 etc

    Hello
    A little convoluted but this seems to work:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Although using SUMPRODUCT the use of the IF function means this must be entered as an array with Ctrl+Shift+Enter. If correctly entered you will see the curly brackets {} around the formula. Format the formula cell: [h]:mm.

    DBY

  13. #13
    Registered User
    Join Date
    06-24-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    6

    Re: Sum of 09:00 - 17:00 etc

    Brilliant! Thank you ever so much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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