简体   繁体   中英

Excel SUMIF criteria within range of numbers

I was wondering how to represent the criteria argument in the function =SUMIF(range, criteria) as instead of ">0" which represent greater than zero, which would add all numbers in the range that are greater than zero. I was wondering how to make it within the range of zero to 8, so "8>0", or something, but I have been googling for hours and cannot find a solution that doesn't involve doing whacky things with SUMIFS which involves other arrays which I do NOT want to get into because I feel there's a simple solution to this that I'm missing... Theres ">=NUM" "<=NUM" ">NUM" and "<.NUM" how do you make it require two of these? Is there any documentation on this anywhere? 在此处输入图片说明

More info here

    =SUMIFS(A1:A11,A1:A11,">=-10",A1:A11,"<=0")

SUMIFS has many (in this case two) conditions, broken down as follows:

=SUMIFS(A1:A11 - SUM() whatevers in A1:A11

, - That match the following conditions

A1:A11,">=-10" - ALL numbers in A1:A11, that are greater than OR equal to -10

, - AND

A1:A11,"<=0" - ALL numbers in A1:A11, that are less than OR equal to 0

)

I agree with @user3240704 that SUMIFS is the way to go.

If you insist on using SUMIF only then you can use the following logic:

  • take the sum of the entire range
  • deduct the sum of values <-10
  • further deduct the sum of values >0

Which is the inverse of saying

  • only the sum the values >=-10 and <=0

The formula is:

=SUM(A1:A11)-SUMIF(A1:A11,">0",A1:A11)-SUMIF(A1:A11,"<-10",A1:A11)

Eg

在此处输入图片说明

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