2

Is it possible to compare a vector of values to a single scalar value in Excel?

Example:

=IF(A1:Z1 > 0, 1, 0)

Typically, I've seen the following:

=IF( AND( A1>0, B1>0, C1>0, . . . Y1>0, Z1>0 ), 1, 0)

Ƭᴇcʜιᴇ007
  • 111,883
  • 19
  • 201
  • 268
kando
  • 185
  • 1
  • 11

2 Answers2

4

How about

=IF(COUNTIF(A1:Z1,">0")=COUNT(A1:Z1),1,0)

or

=IF(COUNTIF(A1:Z1,">0")=COUNTA(A1:Z1),1,0)

or

=IF(COUNTIF(A1:Z1,">0")=COLUMNS(A1:Z1),1,0)

depending on which works best in your situation.

Engineer Toast
  • 4,955
  • 1
  • 20
  • 33
4

Although this doesn't address the generalized question, for your particular example wouldn't this do the trick?

=IF( Min(A1:Z1) > 0, 1, 0)

If the smallest one is greater than 0, then they all are. Otherwise there is at least one that is not greater than 0.

Adam
  • 910
  • 7
  • 21