+ Reply to Thread
Results 1 to 5 of 5

How to Total the number of hours-worked on each date?

Hybrid View

  1. #1
    Registered User
    Join Date
    09-28-2010
    Location
    California, USA
    MS-Off Ver
    Excel 2007
    Posts
    91

    How to Total the number of hours-worked on each date?

    Hello, people,

    I studied the SUBTOTAL thing, but... maybe that's not what should be used here?

    In the attached sample file, I want the Total of hours worked on each day, in column P.
    That is,... when column B changes, put a total of the column H hours in column P.

    In the file, columns O and P and Q were manually created.
    Column O shows the number of time-spans (rows) for any certain date.
    Column P is what I want to automatically calculate...
    it shows the total number of hours worked on that date.
    Column Q shows the overtime $amount that I should get (at the $16.5/hour rate,
    with time-&-a-half for hours 8.01 thru 10, and double-time above 10 hours.)

    HOW to automatically calculate column P?

    Thanks, in advance.

    Mark53

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: How to Total the number of hours-worked on each date?

    combination of countif/sumif should do the trick

    in O5
    Formula: copy to clipboard
    =IF(COUNTIF($B$5:B5,B5)=0,"",IF(COUNTIF($B$5:B5,B5)=COUNTIF(B:B,B5),COUNTIF($B$5:B5,B5),""))


    in p5
    Formula: copy to clipboard
    =IF(O5="","",SUMIFS(H:H,B:B,B5))


    in column Q
    not quite sure the logic is but the formula in there doesnt seem to work on certain lines
    Last edited by humdingaling; 12-20-2017 at 12:21 AM.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    09-28-2010
    Location
    California, USA
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: How to Total the number of hours-worked on each date?

    Brilliant.
    Even after studying that COUNTIF thing for a while, I can barely understand how it works, but it seems to.
    And the SUMIFS thing is almost as confusing. Ah, well...
    Thanks very much, Humdingaling. Merry Christmas.
    Mark53

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: How to Total the number of hours-worked on each date?

    =IF(COUNTIF($B$5:B5,B5)=0,"",IF(COUNTIF($B$5:B5,B5)=COUNTIF(B:B,B5),COUNTIF($B$5:B5,B5),""))

    the first part of the formula it just to keep it tidy
    Formula: copy to clipboard
    IF(COUNTIF($B$5:B5,B5)=0,""

    basically for rows with no dates

    so the next bit
    Formula: copy to clipboard
    IF(COUNTIF($B$5:B5,B5)=COUNTIF(B:B,B5),COUNTIF($B$5:B5,B5),""))


    so what i am doing here is comparing the number of dates on the list
    Formula: copy to clipboard
    COUNTIF(B:B,B5)

    vs
    number of dates up to the current row
    Formula: copy to clipboard
    COUNTIF($B$5:B5,B5)


    $B$5:B5
    changes to
    $B$5:B6 in row 6
    $B$5:B7 in row 7
    etc
    so as it goes along the range it looks at increases accordingly

    as such counts of date up to the current row

    so the if formula is check ...if the amount of dates in the whole list is the same current row
    COUNTIF($B$5:B5,B5)=COUNTIF(B:B,B5)

    if you understand and prefer countif syntax
    then you can substitute it with sumif instead (in your case)
    https://www.techonthenet.com/excel/formulas/sumif.php
    basically the syntax is the same as countif
    SUMIF( range, criteria, [sum_range] )


    sumifs i just used because i prefer using sumifs instead of sumif
    https://www.techonthenet.com/excel/formulas/sumifs.php
    SUMIFS( sum_range, criteria_range1, criteria1, [criteria_range2, criteria2, ... criteria_range_n, criteria_n] )
    whereby the sum range goes first BUT you can add more criteria should you require it

    sumif is limited to 1 criteria

  5. #5
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: How to Total the number of hours-worked on each date?

    Merry xmas to you too
    thanks for the rep

+ 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. VBA place hours worked on master sheet depending of the date worked in that week
    By guhaseelan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-22-2017, 10:35 AM
  2. [SOLVED] How to work out number of 'days' worked based on total hours
    By tangcla in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-20-2016, 10:12 PM
  3. Replies: 0
    Last Post: 01-18-2016, 03:55 PM
  4. [SOLVED] Calculate total hours worked between 2 date/time stamps ignoring weekends and holidays
    By drewship in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-01-2015, 09:59 AM
  5. Replies: 4
    Last Post: 02-12-2013, 07:01 AM
  6. Replies: 6
    Last Post: 05-03-2010, 12:03 PM
  7. total of hours worked
    By carolynkeene in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-21-2006, 03: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