Find which of multiple Unique Text Strings are present within a Longer Text String

britz

New Member
Joined
Apr 7, 2013
Messages
5
Im using Excel 2007 & Windows 7. I do not have any programing or VBA experience.

I have managed to be able to find when the "Unique Text String" is present in a "Longer Text String" by using the function =SEARCH(TRIM(D3),TRIM(A3)).
The "Longer Text String" varies in length & sometimes contains extra spaces, hence the need for the Trim operation.

The issue I have, is that I now want to be able to search each "Longer Text String" & identify which of the "Unique Text Strings" is present, then tell me the corresponding related No.
If it were only 5 "Unique Text Strings", then it would be easy to create 5 columns, one for each of the "Unique Text Strings" to the right & customise the formula for each "Unique Test String" in each column.

The tricky bit is there are over 60 "Unique Text Strings" & thousands of "Longer Text Strings". So I would like to do this in a lot less than 60 separate functions.
I hope you can give me some ideas?


Longer Text Strings
No.
Unique Test String
The Brown Fox in the box 1
1
Brown Fox
The Black Cat on the mat
2
Black Cat
The Bird in the Tree
3
Tree
The Snake on the Grass
4
Snake
The man on the moon
5
Moon
The Brown Owl on the Barn
The Dog fighting the Cat
The Small Tree in the Garden
The Brown Fox in the box 2

<tbody>
</tbody>
 
Hi Hiker95,

Thanks again for your time & your clear instructions.
Ive not previously run macro code other than the basic record function.
I followed your instructions to a tee & to my surprise, this code worked like a charm. Really cool how multiple results appear int he one cell where applicable.

Thanks again for your time & Interest.

Regards,

Britz
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
britz,

Thanks for the feedback.

You are very welcome. Glad I could help.

And, come back anytime.
 
Upvote 0
Hi Britz,

I misunderstood your requirement, I assumed you wanted a count of all the Unique Strings within the longer string!

You have been provided with an excellent solution by Hiker95, but thanks for the feedback. :biggrin:

Excel Workbook
ABCDEFGH
1Longer Text StringsSingle String ResultNo.Unique Test String# Uniq Strings
2The Brown Fox in the box 111Brown Fox1
3The Black Cat on the mat72Black Cat3
4The Bird in the Tree33Tree1
5The Snake on the Grass74Snake2
6The man on the moon75Moon2
7The Brown Owl on the Barn76Cat1
8The Dog fighting the Cat67On1
9The Small Tree in the Garden31
10The Brown Fox in the box 211
11
Sheet2


Ak
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,563
Members
448,972
Latest member
Shantanu2024

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