+ Reply to Thread
Results 1 to 8 of 8

Sum If - (multiple criteria based on range)

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-10-2011
    Location
    New York, NY
    MS-Off Ver
    MS Office: Excel 365
    Posts
    163

    Sum If - (multiple criteria based on range)

    hi,

    I have a file and would like to use the sum if formula (i think) to look for a large amount of criteria, based on a range.

    for example, if sheet2 has a (2 column) table that lists different foods (col. A) vs. quantities (col. B), such as:

    Apple (2)
    Meat (2)
    Orange (4)
    Crackers (5)
    Grape (6)
    Banana (10)
    . . .

    and a separate sheet in the file has a field for "Fruits", with a field next to it that would show the sum of all the fruit quantities in sheet1, how do I do it? I don't want to use the "AND" function, because what I I have 20+ fruits.

    is there a way to use the sum if function to look up all criteria in a one-column range (listing all the fruits that show up in sheet2)?
    thank you
    (sorry if i was unclear)


  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Sum If - (multiple criteria based on range)

    Something like this maybe..

    =SUM(SUMIF(A1:A100,{"Apple","Banana","Grape",'Orange"},B1:B100))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Contributor
    Join Date
    11-10-2011
    Location
    New York, NY
    MS-Off Ver
    MS Office: Excel 365
    Posts
    163

    Re: Sum If - (multiple criteria based on range)

    Quote Originally Posted by Ace_XL View Post
    Something like this maybe..

    =SUM(SUMIF(A1:A100,{"Apple","Banana","Grape",'Orange"},B1:B100))
    but what if there are 20 or even 50 fruit, is there a way to reference a range that lists them all?

  4. #4
    Registered User
    Join Date
    09-30-2012
    Location
    Perth, Australia
    MS-Off Ver
    MSO all versions to 2007
    Posts
    30

    Re: Sum If - (multiple criteria based on range)

    just add a new column in sheet2 with a classification of "fruit" or otherwise, and use that as your condition.....

  5. #5
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Sum If - (multiple criteria based on range)

    Quote Originally Posted by xtinct2 View Post
    but what if there are 20 or even 50 fruit, is there a way to reference a range that lists them all?
    Try this:

    Assuming your criteria in D1:D50

    =SUMPRODUCT(--(ISNUMBER(MATCH(A1:A100,D1:D50,0))),B1:B100)

    Adjust your range to suit

  6. #6
    Forum Contributor
    Join Date
    11-10-2011
    Location
    New York, NY
    MS-Off Ver
    MS Office: Excel 365
    Posts
    163

    Re: Sum If - (multiple criteria based on range)

    Quote Originally Posted by Teethless mama View Post
    Try this:

    Assuming your criteria in D1:D50

    =SUMPRODUCT(--(ISNUMBER(MATCH(A1:A100,D1:D50,0))),B1:B100)

    Adjust your range to suit
    yes, thank you!!!

  7. #7
    Forum Contributor
    Join Date
    11-10-2011
    Location
    New York, NY
    MS-Off Ver
    MS Office: Excel 365
    Posts
    163

    Re: Sum If - (multiple criteria based on range)

    hi, me again,

    lets say I have another column (3 columns in total) in sheet two that lists countries, and the field that returns the total fruit count has it per country for instance, Africa fruit quantity, Sweden fruit qty, etc.. Example:

    Africa - Apple - 2
    Sweden - Meat - 2
    USA - Orange - 4
    Africa - Crackers - 5
    Africa - Grape - 6
    USA - Banana - 10

    the desired formula would return "8"

    Thank you

  8. #8
    Registered User
    Join Date
    10-26-2012
    Location
    Riga
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    6

    Re: Sum If - (multiple criteria based on range)

    I recently had the same issue and thanks to help from this forum solved it with such approach
    =SUMPRODUCT(SUMIFS(Data!C:C;Data!A:A;Result!C19;Data!B:B;Result!L1:L17))
    where C19 has Your Africa and L1:L17 is the list of fruits.(assuming criteria is defined on the list with results.
    Last edited by mozhils; 11-15-2012 at 11:20 AM.

+ 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