简体   繁体   中英

Excel summing values based on multiple conditions

I have the following excel sheet, and I want to sum values based on an a match value and effect code.

Effect Code   Value   Match Code  Numerator    Denominator
      2        500      111000    
      8        700      111000
      2        900      111000
      8        560      111000
      5        100      211000    
      8        200      211000
      7        300      211000
      8        750      211000

Now the numerator is the sum of all match codes with an effect code equal to 8 and the denominator is any effect code that is not 8. so I would like to get the following:

Match code    Numerator    Denominator

  111000        1260           1400
  211000         950            400

I have Hundreds of thousands of rows in the excel spreadsheet which I would like to do this on. I have tried using the following to do the summation, however it is not working properly and I cannot seem to figure out how to fix it:

=SUMIF(Match_Code,C2,Value)

The other problem I will have with the type of solution above is that I will have a bunch of duplicates of the Match Code, when in the end I just want one with the values of the numerators and denominators summed up. Any other solutions that could get around this problem would be appreciated.

Abandon the SUMIF function and use more criteria with a SUMIFS function .

=sumifs(Value, Match_Code, C2, Effect Code, 8)
=sumifs(Value, Match_Code, C2, Effect Code, "<>8")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM