Returning common substrings

Skoogh

New Member
Joined
Mar 23, 2017
Messages
2
Hi everyone,

First off, LOVE this forum. Has helped me a lot before. I am however feeling stuck this time around and haven't really found a good solution.

I have a lot of rows with various product names, what I want to do is to go through the names and return some of the substrings in order to group them properly.

Sample data

Return StringProduct Name
Teddy Bear1234 - Teddy Bear 56x78 white
Teddy Bear4321 - Teddy Bear 80x90 Brown
Mop with Handle6789 - Mop with golden Handle
Mop with Handle1011 - Mop with white Handle
etcetc

As you can see, part of the things I would like to disregard are things like colour and dimensions. I've been dabbling with the text to columns to build new strings, partly automatic but also a lot of manual work involved in that. And it would be great if I could find a code to do this instead as I would like to do this in numerous sheets.

I believe the solution would look something like a for loop going through every item and then a new for loop going through all other items to find the common substrings and then return them in the "Return String" column. Would that work and how would it look like? is there another/better way?

Thanks a lot in advance!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Seems to me you want to run a series of SUBSTITUTEs to a) replace digits 0 - 9 to blank, b) all color words to blank, c) hyphen to blank, d) " x " to blank, e) double space to single space.

If you apply that to the examples you gave above, you'll get the two return strings you want.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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