nested if
"Gary Wessle" wrote...
how can I write a function to check if 4 cells contain negative number
then it returns the word "neg" but if all cells are positive it return
"pos"?
If all 4 cells are in a single range, e.g., C3:C6, you could use formulas
like
=IF(COUNTIF(C3:C6,"<0")=4,"neg",IF(COUNTIF(C3:C6," 0")=4,"pos","other"))
If the 4 cells aren't in a single range, you could use FREQUENCY.
=IF(INDEX(FREQUENCY((C3,D5,E7,F9),{-1E-300;0}),1)=4,"neg",
IF(INDEX(FREQUENCY((C3,D5,E7,F9),{0}),2)=4,"pos"," other"))
Neither need to be entered as array formulas.
|