+ Reply to Thread
Results 1 to 11 of 11

total hours between 2 dates

  1. #1
    Registered User
    Join Date
    04-21-2006
    Posts
    26

    total hours between 2 dates

    Hi great helpers,
    I want to add the numbers of hours in a 4 week period. I have used the following formula (from this site) to total according to month but I don't seem to be able to adapt it to change it to only add hours between 2 dates or for the 28 day period. Can you help please. I thought maybe I should be using a SUMIF but I can't get that happening either.

    I have attached a simple file( I think!!)

    =SUMPRODUCT((TEXT($B$3:$B$61,"mm/yy")="07/07")*($C$3:$D$61))

    thanks in anticipationSUMIF questionxls.xls

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,962
    Try:
    Please Login or Register  to view this content.
    It totals the B column to 49 in this case.
    Attached Files Attached Files
    Last edited by protonLeah; 07-21-2008 at 03:06 AM.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-21-2006
    Posts
    26
    Thanks for replying so promptly.

    I can total for a month by name, but I need to total hours for 28 day period starting from 14/7/08. The 28 day period may go into the next month.
    maztaz

  4. #4
    Registered User
    Join Date
    04-21-2006
    Posts
    26
    Hi protonLeah
    I hope I didn't offend with my short answer yesterday. Didn't mean to but I failed to see the attachment and the great little gadget. Thankyou - very handy. What do you call the 'slider' so I can learn about how to do it.

    I feel I may have to experiment with DATE functions to sum for a given number of days or between two dates.
    thanks again for your help
    maztaz

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Try =SUMPRODUCT( ($A$3:$A$30 >= "7/14/08" + 0) * ($A$3:$A$30 <= "7/14/08" + 27) * $B$3:$B$30)

  6. #6
    Registered User
    Join Date
    04-21-2006
    Posts
    26
    Thanks for that formula. I got a value error at first but changed the date format and it works a treat.

    thanks again to both helpers.

    maztaz

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,723
    It ay be simpler if you put the start date in a cell, e.g. in Cell E2 put the date 14-Jul-08 and then use shg's suggested formula adapted as follows:

    =SUMPRODUCT( ($A$3:$A$30 >= E2) * ($A$3:$A$30 <E2 + 28) * $B$3:$B$30)

    In this way you can more easily change the date period

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    I agree with DLL, except the 28 should be 27 for a 28-day period.

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,723
    .....but I used < 28 rather than <=27 so it comes to the same thing

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    I just kinda missed that ...

    That is indeed more intuitive.

  11. #11
    Registered User
    Join Date
    04-21-2006
    Posts
    26
    Thanks for the interest DLL. I'll try your version too. Trying to work out formulae when you're on your own with no training is hard. I don't understand much of the lingo. I really appreciate the gurus at this site
    Thanks again

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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