SUMIF with two conditions

Hi!


I want to sum numbers between a certain range and need to add second condition to this working formula.


SUMIF(Table 1::C2:C6139;"<250";Table 1::C2:C6139)


That formula will sum all the values less than 250.

But for all the other values (250-500 and 500-1000, etc) I need two conditions.


SUMIFS(Table 1::C2:C6139;"<500";Table 1::C2:C6139;">250")

doesn't work, while the same with COUNTIFS work.

Where do I put my second condition? :-)

iMac, Mac OS X (10.7.2), 27", i7, 256 SSD, 8GB, 1GB graphic

Posted on Jul 26, 2017 3:35 AM

Reply
4 replies

Jul 26, 2017 4:49 AM in response to suntrop

the syntax for sumifs is different than what you are using. You can always get the syntax using the built-in function browser. type the first part of the function:

User uploaded file

, then select the contextual menu using the down-pointing expose triangle:

User uploaded file


now you can see the function browser on the right.


from that the help says:

SUMIFS(sum-values, test-values, condition, test-values…, condition…)

sum-values: A collection containing the values to be summed. sum-values can contain number values, date/time values, or duration values.

test-values: A collection containing values to be tested. test-values can contain any value.

condition: An expression that compares or tests values and results in the boolean value TRUE or FALSE. Condition can include comparison operators, constants, the ampersand concatenation operator, references, and wildcards. You can use wildcards to match any single character or multiple characters in the expression. You can use a ? (question mark) to represent one character, an * (asterisk) to represent multiple characters, and a ~ (tilde) to specify that the following character should be matched rather than used as a wildcard.

test-values…: Optionally include one or more additional collections containing values to be tested. Each test-valuescollection must be followed immediately by a condition expression. This pattern of test-values, condition can be repeated as many times as needed.

condition…: If an optional collection of test-values is included, an additional expression that results in a boolean value TRUE or FALSE. There must be one condition following each test-valuescollection; therefore, this function will always have an odd number of arguments.



so the syntax is one range to sum followed by pairs of a test value range and a condition



User uploaded file


I made a "short version" of you formula that only summed a few cells of a table


The correct version for you is:


=SUMIFS(C2:C3169;C2:C3169;"<500";C2:C3169;">250")


note in the US we use the comma as the thousands separator and the period for the decimal. So we use the comma as the argument delimiter. However where you are you use the commas as the decimal so you use the semicolon as the argument delimiter.

Aug 5, 2017 8:01 AM in response to suntrop

Hi suntrop,


Just a note to add:


In your example, you specify the first range of values to be summed as "<250" and the second range as ">250 and <500". With those range settings, any cell containing the exact value 250 will be excluded from both sums.


To include 250 (and to include 500 in the second range), change "<250" to "<=250" in the first range condition, and make the same change for the highest value condition for each of the following ranges.


OR


To include 250 in the second range (and 500 in the third, etc.), leave the "<" signs as is and change the ">" signs to ">=" for the lowest value to be included in each range.


Example:

User uploaded file

Formula shown below the table is from cell D2.

Formulas in cells below D2 contain the edited conditions shown in column C.


Regards,

Barry

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

SUMIF with two conditions

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.