Reputation: 3
Basically what I'm trying to do is have the value in C7 shown if the cell isn't empty and if the the cell range C8:C16 contains only 0s. I'm using the code below but I can't get the syntax right
=IF(NOT(ISBLANK(C7))),AND(IF(ISBLANK(C8:C16))),c7
Upvotes: 0
Views: 77
Reputation: 1069
=IF(AND(NOT(ISBLANK(C7)),COUNTIF(C8:C16,"0")=5),C7,)
You need countif
to check how many values are 0. If checks only if one of them is 0.
Upvotes: 1
Reputation: 2713
try this below formula
=IF(AND(SUM(C8:C16)=0,C7<>""),C7,"")
Upvotes: 0
Reputation: 71538
Assuming that the formula is being put in a cell other than C7 and C8:16, then you could use this:
=IF(AND(C7<>"",COUNTIF(C8:C16,0)=9),C7)
This will check if both C7 is not blank and C8:C16 contains 9 zeroes (hence all contain 0), and only when the two are true, it will return the value from C7.
The syntax for AND
is:
AND(expr1, expr2, ...)
Where exprN
is an expression that returns a boolean value (true/false or 1/0
)
In case C7 is blank and/or C8:C16 contains a non-zero value, the above will return FALSE
. If you want something specific instead, then use something like this perhaps:
=IF(AND(C7<>"",COUNTIF(C8:C16,0)=9),C7,"return this sentence if false")
Upvotes: 1