Referencing a range of columns and rows with the IF function

C

Cliff

I am trying to use the following IF function to search a range of cells to
find the number 1 and then return either 1 or leave the cell blank. However,
it does not look at the range of cells.

A4=IF(A1:AS3=1),1,""

Any sugestions would help.
 
D

daddylonglegs

If you want to return 1 if 1 occurs anywhere in that range

=IF(COUNTIF(A1:AS3,1),1,""
 
D

daddylonglegs

In this formula

=IF(COUNTIF(A1:AS3,1),1,"")

the first 1 is what you're counting within the range. If the count is 0
then the formula will return "", i.e. a blank, if the count is anything
else, i.e. 1 or higher the formula returns a 1.

If you were searching for something else in the range, e.g. a letter x
then the formula would be

=IF(COUNTIF(A1:AS3,"x"),1,"")
 
D

daddylonglegs

Not quite sure what you're saying. Do you want the formula to return a
only when there is only a single 1 in the range?

If so

=IF(COUNTIF(A1:AS3,1)=1,1,""
 
C

Cliff

I tried both of your formulas and they did not search the range of cells I
believe. With 1 in all referenced cells the formula cell was blank.
 
Top