+ Reply to Thread
Results 1 to 5 of 5

Thread: Sum values based on value of two columns

  1. #1
    Registered User
    Join Date
    06-01-2004
    Posts
    11

    Sum values based on value of two columns

    Hi there,

    I have a sheet with activities send by multiple employees. It looks like this:

    .....A...............B..........C
    1 activity_A....client_A...7
    2 activity_B....client_A...1

    6 activity_A....client_A....4
    7 activity_A....client_D....4

    What I need is to sum the hours that matches "activity_A" in column A and "client_A" in column B. In this case row 1 and 6 are matches, so the sum is 7+4=11 hours.

    Do I need SUMPRODUCT or VLOOKUP or a combination? I want the formula to be lean, because I need lots of them...
    Last edited by Hond70; 10-11-2011 at 06:00 PM.

  2. #2
    Forum Moderator arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    4,371

    Re: Sum values based on value of two columns

    If you are using Excel 2007, this should suffice:

    =SUMIFS(C1:C4,A1:A4,A1,B1:B4,B1)
    If you are using excel 2003, use sumproduct. You dont need vlookup.

  3. #3
    Valued Forum Contributor
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    1,957

    Re: Sum values based on value of two columns

    SUMPRODUCT would probably be the way to go, but if there are lots of them then you might find it a bit slow.

    Assuming your data is in rows 1:100 then the SUMPRODCT would be =SUMPRODUCT(C1:C100,--(A1:A100="activity_A"),--(B1:B100="client_A"))

    Edited to add: Dur, slow brain day, SUMIFS is a better solution if you're using Excel 2007 or later.

  4. #4
    Forum Guru TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,222

    Re: Sum values based on value of two columns

    If you are using Excel 2003, you can use SUMPRODUCT. If you're using Excel 2007 or above you can use SUMIFS.

    Regards
    Last edited by TMShucks; 10-10-2011 at 11:25 AM.

  5. #5
    Registered User
    Join Date
    06-01-2004
    Posts
    11

    Re: Sum values based on value of two columns

    Thanks to all. It had to be Excel 2003 proof, so the sumproduct did the trick!
    Great 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.2.0