+ Reply to Thread
Results 1 to 4 of 4

Sum by ID#

  1. #1
    Registered User
    Join Date
    07-29-2010
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Sum by ID#

    I need a formula that will calculate the sum hours of a specific ID # and also have it only calculate hours if they are from a date newer than today-365. So basically it will only count hours that are from within a year ago today. I attached a very small example.
    Attached Files Attached Files
    Last edited by Intern13; 04-13-2011 at 02:41 PM.

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Sum by ID#

    Enter this formula in E2 and fill down:
    =IF(TODAY()-365<C2,D2,0)

    Enter the Label ID: in cell A6
    Enter the ID you want to sum in B6
    Enter the label Hours: in cell A7

    Enter this formula in cell B7:
    =SUMPRODUCT(--(B2:B4=B6)*(E2:E4))

    NOTE: all of the data provided will provide a sum since it's all less than a year old...

  3. #3
    Registered User
    Join Date
    07-29-2010
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Sum by ID#

    Thank you I think that works perfectly. I appreciate the quick and accurate response.

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Sum by ID#

    I think for more accuracy rather than TODAY()-365 (because sometimes it's 366) you should use this in E2 and down:

    =IF(C2="","",IF(C2>EDATE(TODAY(),-12),D2,""))

    And SUMIF() is preferable to SUMPRODUCT() so:

    =SUMIF(B2:B4,H2,E2:E4) with the ID number you want summed sitting in cell H2.

    If you wish to add another criteria you can use SUMIFS() (available for Excel 2007 and up).
    Last edited by Cutter; 04-13-2011 at 05:23 PM.

+ 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