+ Reply to Thread
Results 1 to 11 of 11

Excel 2007 : SUMIF with 2 criteria

  1. #1
    Forum Contributor
    Join Date
    05-19-2009
    Location
    Santiago, Chile
    MS-Off Ver
    Excel 2019
    Posts
    212

    SUMIF with 2 criteria

    Is it possible to use the SUMIF formula with 2 criterias? For example I have column with "Apple", "Pear" and in other column "Red", "Green".
    Now I want to use the SUMIF formula for all the red apples (not counting the green apples)or all the green pears, etc.
    Last edited by pansovic; 09-08-2010 at 01:05 PM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: SUMIF with 2 criteria

    In Excel 2007 you can use SUMIFS (with an "S" at the end), e.g.

    =SUMIFS(C:C,A:A,"Apple",B:B,"Red")

    to sum column C if you have fruit in column A and colour in B
    Audere est facere

  3. #3
    Forum Contributor
    Join Date
    05-19-2009
    Location
    Santiago, Chile
    MS-Off Ver
    Excel 2019
    Posts
    212

    Re: SUMIF with 2 criteria

    Thanks but I am getting a Value error.
    I send you attached my file. I am trying to create the formula in Sheet1 C2. I have to add up all the numbers in column P and Q of the sheet Inventario with the criteria in column G and H, Sheet Inventario. Take note that the values in those columns are sometimes a text/number or as well result of a formula.
    Attached Files Attached Files

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: SUMIF with 2 criteria

    You can't sum a two column range with SUMIFS if the criteria ranges are single columns (there needs to be a 1 to 1 relationship). Try using an "array formula" like this

    =SUM(IF((INVENTARIO!G$3:G$1000="CH")*(INVENTARIO!H$3:H$1000="EL"),INVENTARIO!P3:Q1000))

    Formula needs to be confirmed with CTRL+SHIFT+ENTER so that curly braces like { and } appear around the formula in the formula bar

  5. #5
    Forum Contributor
    Join Date
    05-19-2009
    Location
    Santiago, Chile
    MS-Off Ver
    Excel 2019
    Posts
    212

    Re: SUMIF with 2 criteria

    For INVENTARIO!G$3:G$1000 and INVENTARIO!H$3:H$1000 I receive a Value Error.
    Did this formula worked for you? What am I doing wrong?

  6. #6
    Forum Contributor
    Join Date
    05-19-2009
    Location
    Santiago, Chile
    MS-Off Ver
    Excel 2019
    Posts
    212

    Re: SUMIF with 2 criteria

    The above formulas don't work one way or another.
    The only way I can do it is by creating a new column and create a formula to take "Apple" from column A and "Red" from column B so that I have in column C "Apple Red", "Pear Green", "Apple Green", etc. Than from that cell I make a simple SUMIFS formula. I than hide the new created column as that it has no use except for making the formula work.
    So by this I consider this case closed
    Last edited by pansovic; 09-07-2010 at 06:11 PM.

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: SUMIF with 2 criteria

    Hi,

    One of your problems is that the apparent "CH" values in the Inventario sheet have four preceding spaces, i.e. ' CH'. (there should be 4 spaces before CH). Either correct that by modifying the formula which adds the spaces, or wrap the whole thing in a TRIM() function, then use the following.

    Please Login or Register  to view this content.
    Alternatively use " CH" in the formula above. (there should be 4 spaces before CH).

    Regards
    Last edited by Richard Buttrey; 09-07-2010 at 06:14 PM.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  8. #8
    Forum Contributor
    Join Date
    05-19-2009
    Location
    Santiago, Chile
    MS-Off Ver
    Excel 2019
    Posts
    212

    Re: SUMIF with 2 criteria

    I will have to study the TRIM function but is it possible that the Spanish SUMAR.SI is different from the SUMIFS? With SUMAR.SI I have to fill in (RANGE,CRITERIA,RANGE SUM) while in your example you put the RANG SUM in the beginning.

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: SUMIF with 2 criteria

    Hi,

    Are you using Excel 2007 or 2003. The SUMIFS() are new to 2007 and if you're using 2003 then the SUMIF() - singular only takes one criteria. It sounds like you may only have the SUMIF version.

    I suggest therefore that you add a helper column to your data and concatenate the G&H column cells. i.e. you'll get ' CHEL'. Now use this helper column in the SUMIF, i.e.

    SUMIF(helpercolumn," CHEL",sum range)

    HTH

  10. #10
    Forum Contributor
    Join Date
    05-19-2009
    Location
    Santiago, Chile
    MS-Off Ver
    Excel 2019
    Posts
    212

    Re: SUMIF with 2 criteria

    This is indeed what I have done but I DO have Excel 2007. Maybe the Spanish version is not that advanced as the English version?

  11. #11
    Registered User
    Join Date
    04-21-2013
    Location
    México, San Luis Potosí
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: SUMIF with 2 criteria

    Inventario resolved.xlsm
    Quote Originally Posted by pansovic View Post
    This is indeed what I have done but I DO have Excel 2007. Maybe the Spanish version is not that advanced as the English version?
    I attached the file with the correct formulm
    =SUMAR.SI.CONJUNTO(INVENTARIO!$P:$P,INVENTARIO!$G:$G,$C3,INVENTARIO!$H:$H,$D3)
    You need to separate the creterial in ordert to look the information
    Columm B Columm C Columm D
    CH EL CH EL

+ 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