Add multiple true values?

Waiting on OP

I'm making a checklist for a video game and need to add multiple checked values.

I'm able to write =IF(B8+B9+B10+B11+B12+B13+B14+B15+B16+B17+B18+B19+B20+B21+B22+B23=16, "Finished!", "Daggers") to switch the section head between Daggers if all boxes aren't checked to Finished! if all boxes are checked. My question is:

I have a lot of sections to do this for, and I was wondering how to do this quicker? I tried =IF(B8:B23=16, "Finished!", "Daggers") and that doesn't work. Any ideas?

Posted Apr 19, 2022, 7:38 PM UTC

211
PM-Me-tittypics•

Try =IF(SUM(B8:B23)=16,"Finished!","Daggers")

1
IshenferiOP•

I tried that, and it just defaults to Daggers regardless of how many boxes are checked.

1
PM-Me-tittypics•

If cell B24 is unused you could try putting the sum there and have the cell you want to check as =IF(B24=16, "Finished!","Daggers") . Tested this in sheets and it worked for me (moblie)

1
IshenferiOP•

Just to confirm, I'm attempting to use an IF function with the sum of checkboxes, not numerical values. So for example:

​

AB
1Dagger[ X ]
2Great Knife[ X ]
1
RemcoE33107•

Try to wrap B8:B23 into COUNTIF(B8:B23,true)

1
IshenferiOP•

I wasn't able to get this to work, does this look right?

=IF((COUNTIF(B8:B23, true), "Finished!", "Daggers"))

1
RemcoE33107•

Try this:

=IF(COUNTIF(B8:B23, true) = COUNTA(B8:B23), "Finished!", "Daggers")
3
Decronym:assistant: Functions Explained•
1
PM-Me-tittypics•

Ahh gotcha. Sorry I don't think I'll be able to help out but I'll keep testing

1
mmistermeh•

Here's two possible solutions with working examples:

Example sheet

First solution:

If you have checkboxes in the range B2:B18 here's a formula you can use:

=IF(COUNTIF(B2:B18,TRUE)=COUNTIF(B2:B18,"<>"&""),"Finished!","Daggers")

This formula has three parts:

  1. COUNTIF(B2:B18,TRUE)

This part counts all TRUE values in the range (checked boxes)

  1. COUNTIF(B2:B18,"<>"&"")

This part counts all non-blank values in the range, meaning both true and false values (checked and unchecked boxes). This works by combining the not equal operator "<>" with a blank string using the concatenation operator "&". (That's just the syntax google sheets needs to understand "not equal to a blank string" in a COUNTIF function.)

  1. The IF statement (the whole formula).

Here the result of the two COUNTIF formulas are compared. If they are equal the IF displays "Finished!" as the text, else it displays "Daggers".

The range can easily be changed as can the TRUE/FALSE result of the IF.

​

Second solution:

=IF(ISERROR(FILTER(B2:B18,B2:B18=FALSE)),"Finished!","Daggers")

In this formula we use FILTER to find all of the FALSE values in the range. We wrap FILTER in ISERROR, which returns TRUE if its contents returns any error.

If there are no FALSE values found in the FILTER, it returns an error, which causes ISERROR to return TRUE, which in turn causes the IF to display "Finished!".

Else if any number of FALSE values are found in the range FILTER returns TRUE, ISERROR returns FALSE and the IF displays "Daggers".

​

I hope this helps!

FYI: I'll delete the example sheet in a few days.

1
_Kaimbe82•
=IF(AND(B8:B23),

Should do the trick

1