ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Find a Cell Value In a Range (https://www.excelbanter.com/excel-worksheet-functions/150598-find-cell-value-range.html)

Michael

Find a Cell Value In a Range
 
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.

Wigi

Find a Cell Value In a Range
 

COUNTIF function does this for you.

=IF(COUNTIF(range,valuetolookup)0,1,0)



--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Michael" wrote:

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.


Rick Rothstein \(MVP - VB\)

Find a Cell Value In a Range
 
Since the desired results are 1 if true and 0 if false, you can eliminate
the IF function call...

=COUNTIF(range,valuetolookup)0

Rick


"Wigi" wrote in message
...

COUNTIF function does this for you.

=IF(COUNTIF(range,valuetolookup)0,1,0)



--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Michael" wrote:

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.



Wigi

Find a Cell Value In a Range
 
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)


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Rick Rothstein (MVP - VB)" wrote:

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

=COUNTIF(range,valuetolookup)0

Rick


"Wigi" wrote in message
...

COUNTIF function does this for you.

=IF(COUNTIF(range,valuetolookup)0,1,0)



--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Michael" wrote:

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.




Rick Rothstein \(MVP - VB\)

Find a Cell Value In a Range
 
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


"Wigi" wrote in message
...
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)


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Rick Rothstein (MVP - VB)" wrote:

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

=COUNTIF(range,valuetolookup)0

Rick


"Wigi" wrote in message
...

COUNTIF function does this for you.

=IF(COUNTIF(range,valuetolookup)0,1,0)



--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Michael" wrote:

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.






All times are GMT +1. The time now is 09:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com