I want to compare values of a range of cells to a single cell's value. I want to know if any cell's value of the range is smaller.
Example:
A1 : 1
A2 : 5
A3 : 7
A4 : 9
B1 : 2
I could use this formula:
=IF(OR(A1<B1,A2<B1,A3<B1,A4<B1),0,B1)
It does what I need. But I'm looking for a more elegant and practical formula than OR because I need to check a range of more than 100 cells.
Which formula do I use?
Thanks in advance.
EDIT: COUNTIF worked fine but now I want to compare a range of values in the same row of 2 columns to a single cell.
Example:
A1 : 1
A2 : 5
A3 : 7
B1 : 2
B2 : 3
B3 : 6
C1 : 11
=IF(OR(AND(A1<C1,B1>C1),AND(A2<C1,B2>C1),AND(A3<C1,B3>C1)),0,C1)
COUNTIF just checks if any cell within and the range is smaller or larger. It doesn't match the rows though.
=if(countif(a1:a4, "<"&b1), 0, b1)
– user4039065=IF(B1<SMALL(A1:A4,1),B1,0)
– Glitch_Doctor