View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
danpt danpt is offline
external usenet poster
 
Posts: 49
Default a formula that return the cell location in a range

Thank you very much.
It works great.


"Gary''s Student" wrote:

Try this small UDF:

Function WhereInTheWorld(rf As Range, r As Range) As String
Dim rr As Range
WhereInTheWorld = "No Luck"
v = rf.Value
For Each rr In r
If rr.Value = v Then
WhereInTheWorld = Replace(rr.Address, "$", "")
Exit Function
End If
Next
End Function


and use in the worksheet like:


=WhereInTheWorld(A4,A5:E40)



--
Gary''s Student - gsnu200851


"danpt" wrote:

Element value is in A4 and the range is A5:E30
B4 is to show the location

Element value may not be unique.
Thanks