+ Reply to Thread
Results 1 to 5 of 5

SUMIF to add values only from selected rows based on a list

  1. #1
    Registered User
    Join Date
    11-23-2010
    Location
    Los Angeles, CA
    MS-Off Ver
    Office 365
    Posts
    15

    Question SUMIF to add values only from selected rows based on a list

    Hi, I am having trouble figuring out how to combine SUMIF and VLOOKUP. I have a large table with a list of names in column A, then various numbers and statistics associated with each name in the remaining columns. I want to add the numbers in a couple of columns, but only for some of the names in column A. The logic I'm trying to use is to sum the number in column B if the name in column A appears in a list on a different sheet.

    Example:

    A - B - C
    Allen - 10 - 14
    Bob - 15 - 12
    Charlie - 18 - 13
    David - 3 - 42
    Edward - 19 - 3
    Frank - 2 - 20

    Second sheet list:

    Bob
    Charlie
    Frank

    So I would like to create a forumula that will sum the numbers in column B if the name in column A shows up in the smaller list. If it worked correctly, the formula would add only column B's values for Bob, Charlie, and Frank for a total of 35. How do I go about this?

    -Tom
    Last edited by NBVC; 11-23-2010 at 01:52 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUMIF to add values only from selected rows based on a list

    Try:

    =SUMPRODUCT(SUMIF(Sheet1!A1:A6,A1:A3,Sheet1!B1:B6))

    where the original data is in Sheet1A1:B6 and the short list is in sheet2, A1:A3
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: SUMIF to add values only from selected rows based on a list

    Maybe this:

    =SUMPRODUCT(--($A$1:$A$6=Sheet2!$A$1)+($A$1:$A$6=Sheet2!$A$2)+($A$1:$A$6=Sheet2!$A$3), $B$1:$B$6)


    EDIT:
    Ooh, like NBVC's so much better.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    11-23-2010
    Location
    Los Angeles, CA
    MS-Off Ver
    Office 365
    Posts
    15

    Re: SUMIF to add values only from selected rows based on a list

    Thanks NBVC, that worked great and was much simplier than trying to insert a complex VLOOKUP formula into a simple SUMIF formula!

    -Tom

  5. #5
    Registered User
    Join Date
    11-23-2010
    Location
    Los Angeles, CA
    MS-Off Ver
    Office 365
    Posts
    15

    Re: SUMIF to add values only from selected rows based on a list

    This is a new question actually...will start a new thread since this one is solved already.

    -Tom
    Last edited by ride_op; 12-06-2010 at 08:52 PM. Reason: Deleting to start new thread

+ 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