Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 504
Default return the reference of a cell with certain text in it

Hello all,

I would like to find a formula that will search for the cell containing the
word "Doctor 1" and return the reference (location) of that cell (such as A1
or R1C1).

thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default return the reference of a cell with certain text in it

On Fri, 30 Nov 2007 09:41:13 -0800, Kevin
wrote:

Hello all,

I would like to find a formula that will search for the cell containing the
word "Doctor 1" and return the reference (location) of that cell (such as A1
or R1C1).

thanks


Here is a UDF that will do that.

RngToSearch is the Range of cells to be searched.
StrToFind is the text string you are searching for. IT can be a string literal
or a cell reference.

You would use this on a worksheet as:
=wordaddress(A18,rng)

To enter it, <alt-F11 opens the VB Editor. Ensure your project is highlighted
in the Project Explorer window, then Insert/Module and paste the code below
into the window that opens:

================================================== =========================
Option Explicit
Function WordAddress(StrToFind As String, RngToSearch As Range) As String
Dim c As Range
For Each c In RngToSearch
If InStr(1, c.Text, StrToFind) < 0 Then
WordAddress = c.Address
Exit Function
End If
Next c
End Function
=============================================





--ron
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default return the reference of a cell with certain text in it

Say your range to search was A1 to D100.
Enter the string to find in E1, then try this *array* formula:

=ADDRESS(MAX((A1:D100=E1)*ROW(A1:D100)),
MAX((A1:D100=E1)*COLUMN(A1:D100)),4)

--
Array formulas must be entered with CSE, <Ctrl <Shift <Enter, instead of
the regular <Enter, which will *automatically* enclose the formula in curly
brackets, which *cannot* be done manually. Also, you must use CSE when
revising the formula.

BTW ... the cell reference returned by this formula is text, and cannot be
used as is, in another formula to reference that cell.

It must be wrapped in Indirect() to work as an actual cell reference.
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

"Kevin" wrote in message
...
Hello all,

I would like to find a formula that will search for the cell containing
the
word "Doctor 1" and return the reference (location) of that cell (such as
A1
or R1C1).

thanks



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return cell reference as text tjc Excel Discussion (Misc queries) 1 August 31st 07 04:26 PM
Return cell reference instead of text from within lookup() functio earls Excel Worksheet Functions 3 December 21st 06 12:43 AM
Return cell reference instead of value lmason Excel Discussion (Misc queries) 1 August 23rd 06 05:53 AM
Return value in cell above the reference Jean Excel Discussion (Misc queries) 4 May 31st 06 07:50 PM
GETPIVOTDATA - return cell reference, not value Slider Excel Worksheet Functions 0 August 29th 05 11:06 PM


All times are GMT +1. The time now is 04:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"