# IF range contains a value then....

#### bob33

##### New Member
Sorry, I'm fried. Likely easy.

I need to look in a range of cells for the value 1 and if there, then 1, otherwise 0.
I thought this would work but doesn't:
=IF(C\$48:C\$51=1,1,0)

Thanks!

### Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

#### galt13

##### Board Regular
it would work if you entered it as an array formula. instead of pressing enter when you type the formula press cntrl+shift+enter

#### Brian from Maui

##### MrExcel MVP
Have you tried using COUNTIF?

=IF(COUNTIF(C48:C51,1)=1,1,0)

#### galt13

##### Board Regular
You could do this.

=IF(ISERROR(MATCH(1,C48:C51,0)),0,1)

#### galt13

##### Board Regular

or for fun you could use

=NOT(ISERROR(MATCH(1,C48:C51,0)))*1

#### Simon4s

##### Board Regular
Sorry, I'm fried. Likely easy.

I need to look in a range of cells for the value 1 and if there, then 1, otherwise 0.
I thought this would work but doesn't:
=IF(C\$48:C\$51=1,1,0)

Thanks!

You need to clarify what you want. Your formula works fine based on what you said you want to do...

If there is a "1" in any cell from C48:51.... then a 1 will be displayed in the cell you entered your "IF". Works perfectly.

#### bob33

##### New Member
I ended up using: =IF(AND(C\$54=0,C\$55=1),1,IF(C49=0,0,1))
which obviously far from my original issue.
Simon4s: It still doesn't work. On my screen now are 2 1s in that range and the value for the formula is 0 (entered as an array formula).

Everyone else: I appreciate your suggestions; I learned some new approaches to the same issue, always a plus!

Replies
3
Views
30
Replies
7
Views
59
Replies
0
Views
34
Replies
5
Views
105
Replies
9
Views
82