+ Reply to Thread
Results 1 to 15 of 15

Puzzled by a simple forumla to sum times based on date criteria

  1. #1
    Forum Contributor
    Join Date
    09-13-2012
    Location
    Midwest
    MS-Off Ver
    Excel 365
    Posts
    124

    Puzzled by a simple forumla to sum times based on date criteria

    I can figure out how to write VB, but figuring out how the formulas work is way more frustrating. I'm pretty sure you excel gurus can answer this in a heartbeat.
    Sum all the time durations in column D if the date in column AA matches the date in cell AL1 (both dates in mm/dd/yy format).
    I tried SUMIF, but keep getting 0:00 (destination cell is formatted to [h]:mm for total time).
    Thank you in advance.

    Luke

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Puzzled by a simple forumla to sum times based on date criteria

    What's your SUMIF formula look like? Does it look like this:

    =SUMIF(AA:AA,AL1,D:D)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Contributor
    Join Date
    09-13-2012
    Location
    Midwest
    MS-Off Ver
    Excel 365
    Posts
    124

    Re: Puzzled by a simple forumla to sum times based on date criteria

    Yup. What am I doing wrong?

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Puzzled by a simple forumla to sum times based on date criteria

    May be :-

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



    adjust the range references as per your need.


    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  5. #5
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Puzzled by a simple forumla to sum times based on date criteria

    did your SUMIF look anythings like this?

    Please Login or Register  to view this content.
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  6. #6
    Forum Contributor
    Join Date
    09-13-2012
    Location
    Midwest
    MS-Off Ver
    Excel 365
    Posts
    124

    Re: Puzzled by a simple forumla to sum times based on date criteria

    I tried that, and it just returns 0:00 but should return 05:00. Could it be something with the date format or is it just the wrong formula altogether?

  7. #7
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Puzzled by a simple forumla to sum times based on date criteria

    sorry, there are a few choices so I'm not sure which one didn't work....could you upload a file and I'm sure one or all of us can get it going?....please remove company sensitive data....

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Puzzled by a simple forumla to sum times based on date criteria

    Quote Originally Posted by lsteinbach View Post
    Yup. What am I doing wrong?
    Well, there are several possibilities.

    The times to sum may not be true Excel time values.

    The dates in column AA may not be true Excel date values.

    The date in cell AL1 may not be a true Excel date value.

    Can you post a SMALL sample file that shows us your data and the formula that is returning the incorrect result?

  9. #9
    Forum Contributor
    Join Date
    09-13-2012
    Location
    Midwest
    MS-Off Ver
    Excel 365
    Posts
    124

    Re: Puzzled by a simple forumla to sum times based on date criteria

    example.xlsx
    the file should be attached. Thanks for the help.

  10. #10
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Puzzled by a simple forumla to sum times based on date criteria

    try this

    Please Login or Register  to view this content.

  11. #11
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,294

    Re: Puzzled by a simple forumla to sum times based on date criteria

    You use now()
    The result is date and time
    Column AA is just a Date
    that is not equal to each other

    Use Today()
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Puzzled by a simple forumla to sum times based on date criteria

    In cell AL1 you have the formula:

    =NOW()-1

    The NOW( ) function returns the current date plus the current time. So, this value may be something like this:

    41434.6172216435

    41434 is the date portion and .6172216435 is the time portion.

    Column AA contains just the date so 41434 in column AA does not match 41434.6172216435 in cell AL1.

    Change the formula in AL1 to:

    =TODAY()-1

    Do the same for the other criteria cells AN1, AM1.

    =TODAY()-2
    =TODAY()-3
    Last edited by Tony Valko; 06-10-2013 at 02:54 PM.

  13. #13
    Forum Contributor
    Join Date
    09-13-2012
    Location
    Midwest
    MS-Off Ver
    Excel 365
    Posts
    124

    Re: Puzzled by a simple forumla to sum times based on date criteria

    judgeh59 nailed it. I thought it might be a formatting issue . . . Thank you all!

  14. #14
    Forum Contributor
    Join Date
    09-13-2012
    Location
    Midwest
    MS-Off Ver
    Excel 365
    Posts
    124

    Re: Puzzled by a simple forumla to sum times based on date criteria

    I did not know about Today(), thank you for the info.

  15. #15
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Puzzled by a simple forumla to sum times based on date criteria

    And TODAY () might be a bit cleaner...but both work....

+ 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