SUMIFS for multiple criteria...

hi, i need to test two different conditions (for both to be TRUE) to result in a sum being displayed. I've tried this formula, but despite both conditions being TRUE, I just get 0 instead of the value in BO69.....


=SUMIFS($B$1="yes", TRUE, Table 1::C69, TRUE, Table 1::BO69)


$B$1 is a drop down list with the word "yes" as an option

Table 1::C69 is a checkbox

Table 1::BO69 is the value if both the conditions are TRUE

MacBook Pro (15-inch Early 2011), Mac OS X (10.7.3)

Posted on Nov 1, 2014 4:31 AM

Reply
21 replies

Nov 1, 2014 5:06 AM in response to ric frankland

btw, i need a number of these formulas on the same line, so it would look something like this:

=SUMIFS($B$1="yes", TRUE, Table 1::C69, TRUE, Table 1::BO69) + SUMIFS($B$1="no", TRUE, Table 1::C69, TRUE, Table 1::BO70) + SUMIFS($B$1="maybe", TRUE, Table 1::C69, TRUE, Table 1::BO71)


i tried this.....


=SUMIF($B$1="yes",AND(Table 1::C69,TRUE),Table 1::BO69)


it works, but not when there is more than one formula :-/

Nov 1, 2014 5:28 AM in response to ric frankland

Hi ric,


I can't see where the sum comes from. Perhaps SUMIFS is not the approach.


From the Function Browser:


The SUMIFS function returns the sum of the cells in a collection where the test values meet the given conditions.

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


Two nested IF statements (I have condensed the table for a smaller pic):

=IF(B1="yes",IF(C1,"OK",""),"")



yes

TRUE

OK


no

TRUE



elephant

TRUE



yes

FALSE



Checkboxes appear as TRUE or FALSE in this pasted table


IF B1 contains yes, [THEN]

IF C1 [THEN]

insert OK [ELSE]

insert "" (NULL) [ELSE]

insert "" (NULL)

[end of formula]


Regards,

Ian.

Nov 1, 2014 8:18 AM in response to ric frankland

Here is yet another, and, in my opinion, more readable solution:


User uploaded file


Cell B1 is blank when A2 is not "Yes" or when the checkbox in cell A3 is not checked.

Cell B2 contains the value in cell A4 when both A1 contains "Yes" and the checkbox is checked


B1=IF(AND(A2="Yes", A3), A4,"")


this is shorthand for... select cell B1, then type (or copy and paste from here) the formula:

=IF(AND(A2="Yes", A3), A4,"")

Nov 5, 2014 4:37 AM in response to charles.christian14

if i was to nest an IF function, would this need to be nested against each of the other IF functions in the long formula i have ...?


IF(AND($B$1="yes", Table 1::C69,TRUE), Table 1::BO69)+IF(AND($B$1="no", Table 1::C69,TRUE), Table 1::BO69)

I've tried it a few different ways but it either does nothing (still shows a figure and not zero) or comes back with a syntax error.


as you can probably tell, i only have a very basic knowledge of formulas, but it almost needs another command at the end of the formula to say something like... OR IF(cell>0,0).... ?!

Nov 5, 2014 4:57 AM in response to ric frankland

Hi Ric,


Back to your original question (we seem to be side-tracked from SUMIF and SUMIFS into nested IFs and maybe that was my fault).

i need to test two different conditions (for both to be TRUE) to result in a sum being displayed.


What is your aim? What are you trying to sum?


The forum software is currently not dependable with screen shots. Please copy the relevant part of your table and paste directly into a reply.


Regards,

Ian.

Nov 5, 2014 5:50 AM in response to Yellowbox

hi Yellowbox, no problem, I've used SUMIF elsewhere and it works well, but obviously this requirement is a little different and I could only get IF to work. Now that it does, I realised that I needed a similar formula to show 0 (zero) if the original cell had a value in it. It's all to do with options!


plus it's all getting very complicated!


here are some screen grabs that will hopefully make sense (cell and formula)....




User uploaded file


User uploaded fileUser uploaded file

this is my standard formula for all items on my sheet.

the cost will vary depending on which building is selected in C1.

(missing row names are 1 for the building type, 54 for electric heating and 55 for water heating)


User uploaded file

User uploaded file

if a checkbox is selected on a different sheet, then the option will be water heating, otherwise it's electric.


User uploaded file


however, the cost for the electric still shows in the table, and i want this to change to 0 (zero). I thought the easiest way was to test the cell directly below, so that if it showed any figure more than 0, then the value for electric heating would be 0.


hope this helps!


User uploaded file

Nov 5, 2014 7:24 AM in response to ric frankland

Ric,


SUMIF and SUMIFS are designed to operate on data sets where you have multiple records (rows) and usually multiple fields of like data.


For instance, if you have an inventory of items that have different shapes, different colors and prices, you can use SUMIFS to determine the total value of the "Blue" "Triangles", for instance.


Let's say that Shape is recorded in Column B, Color in Column C and Price in Column D and you have dozens or hundreds of items (rows).


The expression: =SUMIFS(D, C, "Triangle", B, "Blue") will do that calculation for you.


Then let's say you only want to sum the values of the items that have a checked box in their row, in Column A, which is more like your original question.


The expression: =SUMIF(D, A, TRUE) will sum the prices of all the checked items.


If you are not working on a large list of entries (many rows), you are probably better off just writing some IF-tests.


Jerry

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.

SUMIFS for multiple criteria...

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