hi p45cal,
I received an email to notify me that you updated the thread but I can't see any updates.. am I looking in the wrong place?
Thanks again!
C111
It will have been a spelling correction or some such. The board allows a few minutes to make corrections after posting a message. You probably never saw the first version.
Let's say I named a range (XX10:XX20) and called it: SURNAME. And if I had the name Charlotte within this range and also in cell A1.
And then I wrote: =NameAtTheTop() in cell A2 (I would hope that in cell A2 the word "no" would appear once I have used this UDF).
It becomes obvious that I interpreted your request exactly as written, but not as meant!
=If (top cell in this column=cell in a named range, "yes","no")
I took to mean that if the cell (the cell mind, not its value) at the very top of the column you wrote the formula in was a cell that was included in any Named Range (your SURNAME named range is one example of such) then it would return "yes".
You want to know if the Value in the cell at the top of the column you write the formula in is to be found in any of the cells in a given named range - is that right?
Do you really need a user-defined function for this? If so post back but a formula can do this:
=IF(COUNTIF(SURNAME,INDIRECT(ADDRESS(1,COLUMN()))) > 0,"yes","no")
This formula is quite restricting in that it only uses the topmost cell of the column the formula is written in.
A simpler formula would give you (a) more freedom to choose which cell to check and (b) you wouldn't have to have the formula in the same column!:
=IF(COUNTIF(SURNAME,F1) > 0,"yes","no")
where F1 was the cell being checked.