excel - How to search a range for multiple pieces of text -
i need search f$3
through f$96
cell contain 4 of w3
, x3
, y3
, , z3
. return true
if cells in f$3
f$96
contain four. how do?
currently use
=and(isnumber(search(w3,f$3:f$96)),isnumber(search(x3,f$3:f$96)),isnumber(search(y3,f$3:f$96)),isnumber(search(z3,f$3:f$96)))
but if place formula in aa3
, checks f3
, not f$3
through f$96
i need check cells in range , return true if 1 contains 4 criteria.
sumproduct
, --
(double negative) useful want. sumproduct
expects array of values, cells checked.
this produced example (split multiple lines readability):
=(sumproduct(--(f$3:f$96=w3))>0)+ (sumproduct(--(f$3:f$96=x3))>0)+ (sumproduct(--(f$3:f$96=y3))>0)+ (sumproduct(--(f$3:f$96=z3))>0)
the --
converts true/false 1's , 0's, , adds them (as giving 1 list each sumproduct
, doesn't multiplication, adds). value returned number of cells matched value looking for.
as don't care how many matched, @ least 1 matched, complare result of sumproduct
see if got @ least 1 match (>0
), , test results added together.
the result of calculation 4 if numbers found, 3 if 3 found, , on.
you can either test 4 result, or give people idea of how many had match giving them result.
Comments
Post a Comment