ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Search for data and return cell reference (https://www.excelbanter.com/excel-worksheet-functions/196550-search-data-return-cell-reference.html)

exoticdisease

Search for data and return cell reference
 
I would like a forumla that searches my spreadsheet for a word, e.g. "july"
and returns the reference of the cell that it is in, so I can use it for the
rest of a lookup formula.

Any help would be most appreciated,
Rob

Gary''s Student

Search for data and return cell reference
 
Try this UDF:

Public Function julyy(inRng As Range) As String
Set r = Application.Caller
ad = r.Address
julyy = ""
For Each rr In inRng
If Not Intersect(rr, r) Is Nothing Then
Else
If rr.Value = "july" Then
julyy = rr.Address
Exit Function
End If
End If
Next
End Function

--
Gary''s Student - gsnu200796

John[_22_]

Search for data and return cell reference
 
See Help information for the function =Match()

Returns the relative position of an item in an array that matches a
specified value in a specified order. Use MATCH instead of one of the LOOKUP
functions when you need the position of an item in a range instead of the
item itself.
HTH
John
"exoticdisease" wrote in message
...
I would like a forumla that searches my spreadsheet for a word, e.g. "july"
and returns the reference of the cell that it is in, so I can use it for
the
rest of a lookup formula.

Any help would be most appreciated,
Rob



Mike H

Search for data and return cell reference
 
A UDF perhaps

this goes in a general module

Public Function FindMe(SrchFor As String, Rng As Range) As String
Set x = Application.Caller
For Each c In Rng
If Not Intersect(c, x) Is Nothing Then
Else
If c.Value = SrchFor Then
FindMe = c.Address
Exit Function
End If
End If
Next
End Function

call with =findme(a1,a2:d100)
Were A1 is what you are looking for

Mike

"exoticdisease" wrote:

I would like a forumla that searches my spreadsheet for a word, e.g. "july"
and returns the reference of the cell that it is in, so I can use it for the
rest of a lookup formula.

Any help would be most appreciated,
Rob



All times are GMT +1. The time now is 07:24 AM.

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