Code to display "text containing other text"

ellison

Active Member
Joined
Aug 1, 2012
Messages
340
Office Version
  1. 365
Platform
  1. Windows
Good morning, what a great site!
icon12.png
I wonder if you could help…
I have to sort through different reports from different departments on a monthly basis & turn them into something which (hopefully!) makes sense.
One issue we have is that I have to go through the different (unconfirmed) “descriptions” that people give to different enquiries & boil them down to a set of “approved descriptions” (the approved set is now about 20,000 but is added to all of the time)
I have suggested to the powers-that-be that they could use some data validation or drop-down menus in order to get people to use a set of “approved descriptions”. But apparently the different departments “NEED” this free text type option (& yup, they answered in capitals!)
I’m wondering if there’s a piece of code which would allow me to something like this:
1. Show the incoming list of “unconfirmed descriptions” in one column (generally 100,000 different descriptions but can be more or less)
2. Display on each row the different “approved descriptions” which are contained in that text.

NB I should have mentioned that the “text” can also contain digits, slashes, dashes etc)

So for example, Column A contains the set of “approved descriptions”, Column C contains the set of “unconfirmed descriptions” and then Columns D, E, F, G etc contain the “approved descriptions” which are contained inside that text.

And no entries if there it contains zero "approved!
EG:
approvedunconfirmed descriptionsapproved 1approved 2
nut2 inch nut with special threadnut
platebolt - TBC
insertbackplateplate
insert assembly with nutinsertnut
nutnut

<tbody>
</tbody>

If anybody could point me in the right direction, I’d be eternally grateful. And may even stop thinking terrible thoughts about the people that type in “25 massive nails” one week, then “26 massive nails” the next, then 27, then blah blah the following week lol!!!!
icon11.png

Many thanks
Neil.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Re: Code to display "text containing other text" https://www.mrexcel.com/forum/images/smilies/icon_eek.gif

A
B
C
D
E
F
1
2
approvedunconfirmed descriptionsapproved 1approved 2
3
nut2 inch nut with special threadnut
4
platebolt - TBC
5
insertbackplateplate
6
insert assembly with nutnutinsert
7
nutnut
8
Sheet: Sheet22

Array formula in cell D3:

=INDEX($A$3:$A$5,SMALL(IF(COUNTIF($C3,"*"&$A$3:$A$5&"*")>0,MATCH(ROW($A$3:$A$5),ROW($A$3:$A$5)),""),COLUMNS($A$1:A1)))
 
Upvote 0
Re: Code to display "text containing other text" https://www.mrexcel.com/forum/images/smilies/icon_eek.gif

Sir, you are a genius - that works beautifully!!!!!
:biggrin:
 
Upvote 0
Re: Code to display "text containing other text" https://www.mrexcel.com/forum/images/smilies/icon_eek.gif

Sir, you are a genius - that works beautifully!!!!!
:biggrin:
So, you are comfortable with that sample list in column A, that if a cell in column B contained the text "insert minute assembly", then column C would return "nut"?
 
Upvote 0
Re: Code to display "text containing other text" https://www.mrexcel.com/forum/images/smilies/icon_eek.gif

That is a very good point (& one I hadn't considered!!!)

Is there a way of dealing with that?!

Thanks
Neil
 
Upvote 0
Re: Code to display "text containing other text" https://www.mrexcel.com/forum/images/smilies/icon_eek.gif

Is there a way of dealing with that?!
Hmmm, I'm not sure.
Do you really have up to 20,000 words in column A & up to 100,000 descriptions in column C?
 
Last edited:
Upvote 0
Re: Code to display "text containing other text" https://www.mrexcel.com/forum/images/smilies/icon_eek.gif

yes ... and it grows month by month grrrrrrrrrrrrr

It's okay though Peter, the formula above gets rid of a huge amount of the checking. So we can mop the rest up with a bit of good old fashioned filters, lookups and deleting!

Thanks for your help though

All the best

Neil
 
Upvote 0
Re: Code to display "text containing other text" https://www.mrexcel.com/forum/images/smilies/icon_eek.gif

I think this solves the "nut" type problem (see row 8) but I suspect it will struggle with a range of 20,000 cells in column A. Anyway, you could give it a try.
Formula in D3 (array formula again) is copied across and down.
Note that this lists the words in the order they appear in the column C cell, not the order they appear in column A

Excel Workbook
ABCDE
2approvedunconfirmed descriptionsapproved 1approved 2
3nut2 inch nut with special threadnut
4platebolt - TBC
5insertbackplate
6insert assembly with nutinsertnut
7nutnut
8insert minute assembly plateinsertplate
ellison
 
Upvote 0
Re: Code to display "text containing other text" https://www.mrexcel.com/forum/images/smilies/icon_eek.gif

So, you are comfortable with that sample list in column A, that if a cell in column B contained the text "insert minute assembly", then column C would return "nut"?

Thank you Peter_SSs, I didn't see that as a problem. Look at backplate in cell C5 and cell D5 returns plate in the first post.
 
Last edited:
Upvote 0
Re: Code to display "text containing other text" https://www.mrexcel.com/forum/images/smilies/icon_eek.gif

Look at backplate in cell C5 and cell D5 returns plate in the first post.
Yes, I noticed that when I made my last post but hadn't when I was manufacturing my "nut" example earlier. :oops:
So now I'm not really sure what the desired outcome for 'partial match' examples like that is. :confused:
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,872
Messages
6,122,026
Members
449,061
Latest member
TheRealJoaquin

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