Find a Cell Value In a Range

M

Michael

I would like to look-up a cell's value in a range of cells and return 1 if it
exists or zero if it does not exist in the specified range. I have got to
believe this is a fairly common need. Can anyone help me out with this.
 
R

Rick Rothstein \(MVP - VB\)

Since the desired results are 1 if true and 0 if false, you can eliminate
the IF function call...

=COUNTIF(range,valuetolookup)>0

Rick
 
W

Wigi

Well Rick

I could have left out the IF, but you need that one to return 1 and 0, not
TRUE and FALSE. That's how I read the question.

Another way to get 1 and 0 is:

=--(COUNTIF(range,valuetolookup)>0)
 
R

Rick Rothstein \(MVP - VB\)

Damn! I can't believe I left out the double unary... AGAIN... I seem to have
this mental block about typing them for some reason. Thanks for noting that.

Rick
 
Top