Function to return row number where text is in the row

crimsoneaglet

New Member
Joined
Nov 23, 2015
Messages
6
My questions centers around whether there is a formula which will enable me to locate a specific text string anywhere in an excel worksheet and return the row number on which it is located.

Essentially at present, I am having to use the ctrl+F function to manually look up each text string, then input some corresponding figures which will be located on the row.

Example of the issue below:

Example reference

APN0000001

What I want the formula to do is:

--> Check if the reference above appears anywhere in a worksheet (may be part of a longer text strong within a cell (e.g. Greater Manchester APN0000001-FRT Create))
--> If it does tell me the row number upon which it appears
--> In an ideal world I'd also like another formula which indicates the number of times the above reference appears in a sheet as well, to ensure that if there is more than one row with the reference in I can combine the relevant figures.

I am keen to use a formula as opposed to vba if possible, if it's not then a vba solution would be greatly appreciated.

Thanks!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Welcome to the MrExcel forum!

Here's one way:

Excel 2010
ABCDEFG
1x26
2zzxaa
3
4qx
5
6
7xx
8
9
10x
11
12
13x

<tbody>
</tbody>
Sheet3

Array Formulas
CellFormula
B1{=MIN(IF(ISERR(FIND(A1,$A$2:$H$20)),9999,ROW($A$2:$H$20)))}
C1{=SUM(IF(ISERR(FIND(A1,$A$2:$H$20)),0,1))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>

Change the A2:H20 range to match the range where you want to look for the text string. It will return 9999 if it is not found (if you have more rows than that, you'll need to change that too). Use SEARCH if you want it to be case-insensitive.
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,399
Members
448,958
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top