1st, 2nd, 3rd occurence of text search from the right

seanh1016

Active Member
Joined
Feb 16, 2003
Messages
254
Here's an example of my cells:
a1=person one Name:
a2=person one address:

I'm looking for every occurence of "Name:" It is always on the rightmost side of the cell. And each occurrence is not an evenly spaced amount of rows in between.

Once I find each occurence, I'd like to stack the names in a column.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Here is what I do... might be an easier way.... but this works.

Add two columns to the left of A (you will hide these later)
Now your A data should be in C

In column B enter the following formula:
=if(right(A1,5)="Name:",1,0)
Copy the formula down column B

In column A enter the following formula:
=if(B1=0,0,sum(B1:$B$1))
Copy the formula down column A

Column A counts each occurance of 1 in column B
Column B finds each occurance of "Name:" and marks it with a 1

Now you can name your range A1:Whatever

Do a lookup on another sheet to reference the names.

Column A enter 1-whatever

Lookup:

=vlookup(A1,range,column index,0)
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,323
Members
449,077
Latest member
jmsotelo

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