Find Partial Duplicate values in a column

leeandoona

New Member
Joined
Oct 13, 2016
Messages
45
I have an annoying problem I never seem to solve properly and today I've had another bash at it and I still can't figure out the best way forward. The problem is I have a very large list of data that contains columns that have partial duplicates that I need to identify, and then turn into 'unique' records. Unfortunately the duplicate values can occur randomly at the front, back of middle of the text string and can be either words or numbers or both! For example, here is a sample of what I've got to work with;

[TABLE="width: 406"]
<colgroup><col></colgroup><tbody>[TR]
[TD]SANTAS LITTLE HELPER (116cm)[/TD]
[/TR]
[TR]
[TD]SANTAS LITTLE HELPER (128cm)[/TD]
[/TR]
[TR]
[TD]SANTAS LITTLE HELPER (140cm)[/TD]
[/TR]
[TR]
[TD]PETTICOAT WHITE - ONE SIZE[/TD]
[/TR]
[TR]
[TD]PETTICOAT RED - ONE SIZE[/TD]
[/TR]
[TR]
[TD]PETTICOAT BLACK - ONE SIZE[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (S)[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (M)[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (L)[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (XL)[/TD]
[/TR]
[TR]
[TD]COLOUR CHANGING CRYSTAL BALL[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (128cm)[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (140cm)[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (158cm)

and here's what it ought to look like when I've identified and removed the duplicates;

[TABLE="width: 406"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Description[/TD]
[/TR]
[TR]
[TD]SANTAS LITTLE HELPER[/TD]
[/TR]
[TR]
[TD]SANTAS LITTLE HELPER[/TD]
[/TR]
[TR]
[TD]SANTAS LITTLE HELPER[/TD]
[/TR]
[TR]
[TD]PETTICOAT - ONE SIZE[/TD]
[/TR]
[TR]
[TD]PETTICOAT - ONE SIZE[/TD]
[/TR]
[TR]
[TD]PETTICOAT - ONE SIZE[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]COLOUR CHANGING CRYSTAL BALL[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

As you can see, this makes a lookup unlikely to work well and fuzzylookup isn't really working properly either. I need to essentially identify the duplicates and remove the differentials. :eeek:Is there any VBA that will solve this, or even get close would help? Thanks v much
 
I suggest you get help from another forum that has Word Help section, such as:
http://www.vbaexpress.com/forum/forumdisplay.php?20-Word-Help
because actually Word is better than Excel in dealing with words & character, so I believe you get better chance to get a solution.


That’s being said, if your data is not sensitive, you could upload your workbook (without sensitive data) somewhere (maybe to dropbox.com or google drive)? Then put the link here. Maybe someone here can find a solution.


Actually how do you manually determine the first part? Is it if some words (maybe 1,2 ,3 or 4 words) in the beginning of some cells are the same then those are the first part & considered as duplicate?
<!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:RelyOnVML/> <o:AllowPNG/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves/> <w:TrackFormatting/> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF/> <w:LidThemeOther>EN-US</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:SplitPgBreakAndParaMark/> <w:EnableOpenTypeKerning/> <w:DontFlipMirrorIndents/> <w:OverrideTableStyleHps/> </w:Compatibility> <m:mathPr> <m:mathFont m:val="Cambria Math"/> <m:brkBin m:val="before"/> <m:brkBinSub m:val="--"/> <m:smallFrac m:val="off"/> <m:dispDef/> <m:lMargin m:val="0"/> <m:rMargin m:val="0"/> <m:defJc m:val="centerGroup"/> <m:wrapIndent m:val="1440"/> <m:intLim m:val="subSup"/> <m:naryLim m:val="undOvr"/> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false" DefSemiHidden="false" DefQFormat="false" DefPriority="99" LatentStyleCount="371"> <w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/> <w:LsdException Locked="false" Priority="9" SemiHidden="true" UnhideWhenUsed="true" QFormat="true" Name="heading 2"/> <w:LsdException Locked="false" Priority="9" SemiHidden="true" UnhideWhenUsed="true" QFormat="true" Name="heading 3"/> <w:LsdException Locked="false" Priority="9" SemiHidden="true" UnhideWhenUsed="true" QFormat="true" Name="heading 4"/> <w:LsdException Locked="false" Priority="9" SemiHidden="true" UnhideWhenUsed="true" QFormat="true" Name="heading 5"/> <w:LsdException Locked="false" Priority="9" SemiHidden="true" UnhideWhenUsed="true" QFormat="true" Name="heading 6"/> <w:LsdException Locked="false" Priority="9" SemiHidden="true" UnhideWhenUsed="true" QFormat="true" Name="heading 7"/> <w:LsdException Locked="false" Priority="9" SemiHidden="true" UnhideWhenUsed="true" QFormat="true" Name="heading 8"/> <w:LsdException Locked="false" Priority="9" SemiHidden="true" UnhideWhenUsed="true" QFormat="true" Name="heading 9"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="index 1"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="index 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="index 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="index 4"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="index 5"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="index 6"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="index 7"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="index 8"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="index 9"/> <w:LsdException Locked="false" Priority="39" SemiHidden="true" UnhideWhenUsed="true" Name="toc 1"/> <w:LsdException Locked="false" Priority="39" SemiHidden="true" UnhideWhenUsed="true" Name="toc 2"/> <w:LsdException Locked="false" Priority="39" SemiHidden="true" UnhideWhenUsed="true" Name="toc 3"/> <w:LsdException Locked="false" Priority="39" SemiHidden="true" UnhideWhenUsed="true" Name="toc 4"/> <w:LsdException Locked="false" Priority="39" SemiHidden="true" UnhideWhenUsed="true" Name="toc 5"/> <w:LsdException Locked="false" Priority="39" SemiHidden="true" UnhideWhenUsed="true" Name="toc 6"/> <w:LsdException Locked="false" Priority="39" SemiHidden="true" UnhideWhenUsed="true" Name="toc 7"/> <w:LsdException Locked="false" Priority="39" SemiHidden="true" UnhideWhenUsed="true" Name="toc 8"/> <w:LsdException Locked="false" Priority="39" SemiHidden="true" UnhideWhenUsed="true" Name="toc 9"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Normal Indent"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="footnote text"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="annotation text"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="header"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="footer"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="index heading"/> <w:LsdException Locked="false" Priority="35" SemiHidden="true" UnhideWhenUsed="true" QFormat="true" Name="caption"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="table of figures"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="envelope address"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="envelope return"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="footnote reference"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="annotation reference"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="line number"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="page number"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="endnote reference"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="endnote text"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="table of authorities"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="macro"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="toa heading"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Bullet"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Number"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List 4"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List 5"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Bullet 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Bullet 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Bullet 4"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Bullet 5"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Number 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Number 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Number 4"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Number 5"/> <w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Closing"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Signature"/> <w:LsdException Locked="false" Priority="1" SemiHidden="true" UnhideWhenUsed="true" Name="Default Paragraph Font"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Body Text"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Body Text Indent"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Continue"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Continue 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Continue 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Continue 4"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="List Continue 5"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Message Header"/> <w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Salutation"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Date"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Body Text First Indent"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Body Text First Indent 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Note Heading"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Body Text 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Body Text 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Body Text Indent 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Body Text Indent 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Block Text"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Hyperlink"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="FollowedHyperlink"/> <w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/> <w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Document Map"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Plain Text"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="E-mail Signature"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="HTML Top of Form"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="HTML Bottom of Form"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Normal (Web)"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="HTML Acronym"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="HTML Address"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="HTML Cite"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="HTML Code"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="HTML Definition"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="HTML Keyboard"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="HTML Preformatted"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="HTML Sample"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="HTML Typewriter"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="HTML Variable"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Normal Table"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="annotation subject"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="No List"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Outline List 1"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Outline List 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Outline List 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Simple 1"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Simple 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Simple 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Classic 1"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Classic 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Classic 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Classic 4"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Colorful 1"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Colorful 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Colorful 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Columns 1"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Columns 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Columns 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Columns 4"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Columns 5"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Grid 1"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Grid 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Grid 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Grid 4"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Grid 5"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Grid 6"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Grid 7"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Grid 8"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table List 1"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table List 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table List 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table List 4"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table List 5"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table List 6"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table List 7"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table List 8"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table 3D effects 1"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table 3D effects 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table 3D effects 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Contemporary"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Elegant"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Professional"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Subtle 1"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Subtle 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Web 1"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Web 2"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Web 3"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Balloon Text"/> <w:LsdException Locked="false" Priority="39" Name="Table Grid"/> <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true" Name="Table Theme"/> <w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/> <w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/> <w:LsdException Locked="false" Priority="60" Name="Light Shading"/> <w:LsdException Locked="false" Priority="61" Name="Light List"/> <w:LsdException Locked="false" Priority="62" Name="Light Grid"/> <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/> <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/> <w:LsdException Locked="false" Priority="65" Name="Medium List 1"/> <w:LsdException Locked="false" Priority="66" Name="Medium List 2"/> <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/> <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/> <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/> <w:LsdException Locked="false" Priority="70" Name="Dark List"/> <w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/> <w:LsdException Locked="false" Priority="72" Name="Colorful List"/> <w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/> <w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/> <w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/> <w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/> <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/> <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/> <w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/> <w:LsdException Locked="false" SemiHidden="true" Name="Revision"/> <w:LsdException Locked="false" Priority="34" QFormat="true" Name="List Paragraph"/> <w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/> <w:LsdException Locked="false" Priority="30" QFormat="true" Name="Intense Quote"/> <w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/> <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/> <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/> <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/> <w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/> <w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/> <w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/> <w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/> <w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/> <w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/> <w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/> <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/> <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/> <w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/> <w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/> <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/> <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/> <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/> <w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/> <w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/> <w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/> <w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/> <w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/> <w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/> <w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/> <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/> <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/> <w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/> <w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/> <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/> <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/> <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/> <w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/> <w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/> <w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/> <w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/> <w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/> <w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/> <w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/> <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/> <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/> <w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/> <w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/> <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/> <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/> <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/> <w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/> <w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/> <w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/> <w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/> <w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/> <w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/> <w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/> <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/> <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/> <w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/> <w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/> <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/> <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/> <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/> <w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/> <w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/> <w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/> <w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/> <w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/> <w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/> <w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/> <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/> <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/> <w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/> <w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/> <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/> <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/> <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/> <w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/> <w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/> <w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/> <w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/> <w:LsdException Locked="false" Priority="19" QFormat="true" Name="Subtle Emphasis"/> <w:LsdException Locked="false" Priority="21" QFormat="true" Name="Intense Emphasis"/> <w:LsdException Locked="false" Priority="31" QFormat="true" Name="Subtle Reference"/> <w:LsdException Locked="false" Priority="32" QFormat="true" Name="Intense Reference"/> <w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/> <w:LsdException Locked="false" Priority="37" SemiHidden="true" UnhideWhenUsed="true" Name="Bibliography"/> <w:LsdException Locked="false" Priority="39" SemiHidden="true" UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/> <w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/> <w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/> <w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/> <w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/> <w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/> <w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/> <w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/> <w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/> <w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/> <w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/> <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/> <w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/> <w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/> <w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light Accent 1"/> <w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/> <w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/> <w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/> <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/> <w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful Accent 1"/> <w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful Accent 1"/> <w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light Accent 2"/> <w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/> <w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/> <w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/> <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/> <w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful Accent 2"/> <w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful Accent 2"/> <w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light Accent 3"/> <w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/> <w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/> <w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/> <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/> <w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful Accent 3"/> <w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful Accent 3"/> <w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light Accent 4"/> <w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/> <w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/> <w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/> <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/> <w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful Accent 4"/> <w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful Accent 4"/> <w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light Accent 5"/> <w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/> <w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/> <w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/> <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/> <w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful Accent 5"/> <w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful Accent 5"/> <w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light Accent 6"/> <w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/> <w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/> <w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/> <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/> <w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful Accent 6"/> <w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful Accent 6"/> <w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/> <w:LsdException Locked="false" Priority="47" Name="List Table 2"/> <w:LsdException Locked="false" Priority="48" Name="List Table 3"/> <w:LsdException Locked="false" Priority="49" Name="List Table 4"/> <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/> <w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/> <w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/> <w:LsdException Locked="false" Priority="46" Name="List Table 1 Light Accent 1"/> <w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/> <w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/> <w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/> <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/> <w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful Accent 1"/> <w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful Accent 1"/> <w:LsdException Locked="false" Priority="46" Name="List Table 1 Light Accent 2"/> <w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/> <w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/> <w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/> <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/> <w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful Accent 2"/> <w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful Accent 2"/> <w:LsdException Locked="false" Priority="46" Name="List Table 1 Light Accent 3"/> <w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/> <w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/> <w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/> <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/> <w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful Accent 3"/> <w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful Accent 3"/> <w:LsdException Locked="false" Priority="46" Name="List Table 1 Light Accent 4"/> <w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/> <w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/> <w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/> <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/> <w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful Accent 4"/> <w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful Accent 4"/> <w:LsdException Locked="false" Priority="46" Name="List Table 1 Light Accent 5"/> <w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/> <w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/> <w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/> <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/> <w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful Accent 5"/> <w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful Accent 5"/> <w:LsdException Locked="false" Priority="46" Name="List Table 1 Light Accent 6"/> <w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/> <w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/> <w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/> <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/> <w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful Accent 6"/> <w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful Accent 6"/> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:8.0pt; mso-para-margin-left:0cm; line-height:107%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;} </style> <![endif]-->

Thanks for the tip on the word link. Will try that. Never really gave that much thought to be honest. I could also upload the data, it is not really sensitive.

As for how I determine the first part it is pretty much as you suggest, the point at which the words no longer match is typically the point at which you've found an entry that is essentially a duplicate with a variant value. For example;

monkey likes cheese LOTS
monkey likes cheese SOME
monkey likes cheese LITTLE
Horse like hay ALWAYS

'monkey likes cheese' (is the duplicate or Parent entry) LOTS, SOME & LITTLE (are the variants or children entries that I'd like sat in the column next to the parent). 'Horse like hay ALWAYS' is unique and therefore remains as it is. So what I look for is multiple instances of the same words that are then followed by variable instances. That's how the 'Parent/child' relationship is worked out. Data that appears as a solitary instance with no variables is simply left as it is. So this is why I keep following the loop, count, match route which is possibly not the way to go as you suggest.

I had (almost) figured out a way using excel that was rather clunky and long handed that worked something like this:

Text to columns THEN Textjoin column 1&2 THEN Textjoin that result with column 3 and repeat this so that the split out data is gradually put back together word by word/character. THEN COUNTIF each concatenated cell. At some point the count will then remain the same as all the words will be back together. The point at which the LAST count differed from the next is equal to the data that contained the last exact amount of words and should be equal to the point where the data changes. Then simply SWITCHIF the results to point to the corresponding cell of data. Unfortunately its flawed because the data can have the same count but contain different variables that happen to be the same character length. e.g.

monkey likes cheese ONE
monkey likes cheese TWO

So both get identified using that flawed method as being the same ...Was worth a try though!
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
It can also change each term to the first in the group, but you seem to only want common strings.

Unfortunately I'm not performing a 'lookup' and have no comparison data set to run against. So Fuzzy won't work unless there is a way it can do a Hlookup against itself?:eeek:
 
Upvote 0
Thanks for the tip on the word link. Will try that. Never really gave that much thought to be honest. I could also upload the data, it is not really sensitive.

So attached is an example of the data. Column A are unique ID's that don't contain any obvious methods for identifying 'Unique' records or 'Variant' records. Column B contains the Data. I have also included an example of what I'm trying to achieve on the same worksheet.

[TABLE="width: 1034"]
<colgroup><col><col><col span="4"><col><col></colgroup><tbody>[TR]
[TD]UID[/TD]
[TD]Dataset 1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]UID[/TD]
[TD]Example Parent[/TD]
[TD]Example Child[/TD]
[/TR]
[TR]
[TD]exmp/00005[/TD]
[TD]SANTAS LITTLE HELPER (116cm)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00005[/TD]
[TD]SANTAS LITTLE HELPER[/TD]
[TD](116cm)[/TD]
[/TR]
[TR]
[TD]exmp/00006[/TD]
[TD]SANTAS LITTLE HELPER (128cm)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00006[/TD]
[TD]SANTAS LITTLE HELPER[/TD]
[TD](128cm)[/TD]
[/TR]
[TR]
[TD]exmp/00007[/TD]
[TD]SANTAS LITTLE HELPER (140cm)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00007[/TD]
[TD]SANTAS LITTLE HELPER[/TD]
[TD](140cm)[/TD]
[/TR]
[TR]
[TD]exmp/00008[/TD]
[TD]PETTICOAT WHITE - ONE SIZE[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00008[/TD]
[TD]PETTICOAT - ONE SIZE[/TD]
[TD]WHITE[/TD]
[/TR]
[TR]
[TD]exmp/00009[/TD]
[TD]PETTICOAT RED - ONE SIZE[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00009[/TD]
[TD]PETTICOAT - ONE SIZE[/TD]
[TD]RED[/TD]
[/TR]
[TR]
[TD]exmp/00010[/TD]
[TD]PETTICOAT BLACK - ONE SIZE[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00010[/TD]
[TD]PETTICOAT - ONE SIZE[/TD]
[TD]BLACK[/TD]
[/TR]
[TR]
[TD]exmp/00011[/TD]
[TD]DEATHLY GRIM REAPER (S)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00011[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[TD](S)[/TD]
[/TR]
[TR]
[TD]exmp/00012[/TD]
[TD]DEATHLY GRIM REAPER (M)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00012[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[TD](M)[/TD]
[/TR]
[TR]
[TD]exmp/00013[/TD]
[TD]DEATHLY GRIM REAPER (L)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00013[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[TD](L)[/TD]
[/TR]
[TR]
[TD]exmp/00014[/TD]
[TD]DEATHLY GRIM REAPER (XL)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00014[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[TD](XL)[/TD]
[/TR]
[TR]
[TD]exmp/00015[/TD]
[TD]COLOUR CHANGING CRYSTAL BALL[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00015[/TD]
[TD]COLOUR CHANGING CRYSTAL BALL[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]exmp/00016[/TD]
[TD]DEATHLY GRIM REAPER (128cm)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00016[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[TD](128cm)[/TD]
[/TR]
[TR]
[TD]exmp/00017[/TD]
[TD]DEATHLY GRIM REAPER (140cm)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00017[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[TD](140cm)[/TD]
[/TR]
[TR]
[TD]exmp/00018[/TD]
[TD]DEATHLY GRIM REAPER (158cm)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00018[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[TD](158cm)[/TD]
[/TR]
[TR]
[TD]exmp/00021[/TD]
[TD]CAT (S)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00021[/TD]
[TD]CAT[/TD]
[TD](S)[/TD]
[/TR]
[TR]
[TD]exmp/00022[/TD]
[TD]CAT (M)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00022[/TD]
[TD]CAT[/TD]
[TD](M)[/TD]
[/TR]
[TR]
[TD]exmp/00023[/TD]
[TD]CAT (L)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00023[/TD]
[TD]CAT[/TD]
[TD](L)[/TD]
[/TR]
[TR]
[TD]exmp/00025[/TD]
[TD]HOLY MARY (116cm)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00025[/TD]
[TD]HOLY MARY[/TD]
[TD](116cm)[/TD]
[/TR]
[TR]
[TD]exmp/00026[/TD]
[TD]HOLY MARY (128cm)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00026[/TD]
[TD]HOLY MARY[/TD]
[TD](128cm)[/TD]
[/TR]
[TR]
[TD]exmp/00027[/TD]
[TD]HOLY MARY (140cm)[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]exmp/00027[/TD]
[TD]HOLY MARY[/TD]
[TD](140cm)[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Hi,

Use the below code:
Rich (BB code):
Option Explicit
Option Compare Text
 
Sub Main()
 
  Dim a(), b()
  Dim i As Long, j As Long, k As Long, n As Long
  Dim Rng As Range
  Dim s As String, s1 As String, s2 As String
  Dim w1, w2
 
  ' Set data range A:D
  With ActiveSheet.UsedRange
    Set Rng = .Offset(1).Resize(.Rows.Count - 1).Columns("A:D")
  End With
 
  ' Normalize Dataset
  a() = Rng.Columns("B").Value
  For i = 1 To UBound(a)
    a(i, 1) = Join(TxtToArray(a(i, 1)))
  Next
 
  ' Disable screen updating
  Application.ScreenUpdating = False
 
  ' Sord Rng by Dataset
  With Rng
    .Columns("C").Value = a()
    .Sort .Cells(1, "C"), xlAscending, Header:=xlNo
  End With
 
  ' Convert normalized & sorted Dataset to array
  a() = Rng.Columns("C:D").Value
  For i = 1 To UBound(a)
    a(i, 2) = TxtToArray(a(i, 1))
  Next
 
  ' Do main
  ReDim b(1 To UBound(a), 1 To 2)
  i = 1
  j = i + 1
  Do
    s = vbNullString
    k = 0
    While a(i, 2)(k) = a(j, 2)(k)
      s = s & a(i, 2)(k) & " "
      k = k + 1
    Wend
    If k > 0 Then
      If k <= UBound(a(i, 2)) Then
        s1 = ""
        For n = k + 1 To UBound(a(i, 2))
          s1 = s1 & a(i, 2)(n) & " "
        Next
        s1 = RTrim$(s1)
        s2 = ""
        For n = k + 1 To UBound(a(j, 2))
          s2 = s2 & a(j, 2)(n) & " "
        Next
        s2 = RTrim$(s2)
        If Len(s1) > 0 And s1 = s2 Then
          If j = i + 1 Then b(i, 1) = s & s1 '
          b(j, 1) = b(i, 1)
          b(i, 2) = a(i, 2)(k)
          b(j, 2) = a(j, 2)(k)
        Else
          b(i, 1) = RTrim$(s)
          b(j, 1) = b(i, 1)
          b(i, 2) = a(i, 2)(k) & s1
          b(j, 2) = a(j, 2)(k) & s2
        End If
        j = j + 1
        If j <= UBound(a) Then
          If Not a(j, 1) Like s & "*" Then
            i = j
            j = i + 1
          End If
        End If
      Else
        b(i, 1) = a(i, 2)
        i = j
        j = i + 1
      End If
    Else
      b(i, 1) = a(i, 1)
      i = j
      j = i + 1
    End If
  Loop While j <= UBound(a)
 
  ' Create result
  Rng.Columns("C:D").Value = b()
 
  ' Sort Rng by UID
  With Rng
    .Sort .Cells(1, "A"), xlAscending, Header:=xlNo
  End With
 
  ' Enable screen updating
  Application.ScreenUpdating = True
 
End Sub
 
Function TxtToArray(Txt) As Variant
  Dim a, i As Long, j As Long, s As String
  Dim RegEx As Object
  If RegEx Is Nothing Then
    Set RegEx = CreateObject("VBScript.RegExp")
    RegEx.Global = True
    RegEx.Pattern = "[.,!?:;_\-]"
  End If
  s = RegEx.Replace(Txt, " ")
  If s Like "*(* *)*" Then
    i = InStr(s, "(")
    While i > 0
      j = InStr(i + 1, s, ")")
      If j > 1 Then
        s = Mid$(s, 1, i) & Replace(Mid$(s, i + 1, j - i - 1), " ", "") & Mid$(s, j)
        i = InStr(j + 1, s, "(")
      Else
        i = 0
      End If
    Wend
  End If
  a = Split(s)
  j = 0
  For i = 0 To UBound(a)
    If Len(a(i)) > 0 Then
      a(j) = a(i)
      j = j + 1
    End If
  Next
  If j - 1 < UBound(a) Then ReDim Preserve a(0 To j - 1)
  TxtToArray = a
End Function

The layout of input/output:
Book1
ABCD
1UIDDataset 1Parent (normalized)Child (normalized)
2exmp/00005SANTAS LITTLE HELPER (116cm)SANTAS LITTLE HELPER(116cm)
3exmp/00006SANTAS LITTLE HELPER (128cm)SANTAS LITTLE HELPER(128cm)
4exmp/00007SANTAS LITTLE HELPER (140cm)SANTAS LITTLE HELPER(140cm)
5exmp/00008PETTICOAT WHITE - ONE SIZEPETTICOAT ONE SIZEWHITE
6exmp/00009PETTICOAT RED - ONE SIZEPETTICOAT ONE SIZERED
7exmp/00010PETTICOAT BLACK - ONE SIZEPETTICOAT ONE SIZEBLACK
8exmp/00011DEATHLY GRIM REAPER (S)DEATHLY GRIM REAPER(S)
9exmp/00012DEATHLY GRIM REAPER (M)DEATHLY GRIM REAPER(M)
10exmp/00013DEATHLY GRIM REAPER (L)DEATHLY GRIM REAPER(L)
11exmp/00014DEATHLY GRIM REAPER (XL)DEATHLY GRIM REAPER(XL)
12exmp/00015COLOUR CHANGING CRYSTAL BALLCOLOUR CHANGING CRYSTAL BALL
13exmp/00016DEATHLY GRIM REAPER (128cm)DEATHLY GRIM REAPER(128cm)
14exmp/00017DEATHLY GRIM REAPER (140cm)DEATHLY GRIM REAPER(140cm)
15exmp/00018DEATHLY GRIM REAPER (158cm)DEATHLY GRIM REAPER(158cm)
16exmp/00021CAT (S)CAT(S)
17exmp/00022CAT (M)CAT(M)
18exmp/00023CAT (L)CAT(L)
19exmp/00025HOLY MARY (116cm)HOLY MARY(116cm)
20exmp/00026HOLY MARY (128cm)HOLY MARY(128cm)
21exmp/00027HOLY MARY (140cm)HOLY MARY(140cm)
Sheet1

Regards
 
Last edited:
Upvote 0
Hi,

Use the below code:
Rich (BB code):
Option Explicit
Option Compare Text
 
Sub Main()
 
  Dim a(), b()
  Dim i As Long, j As Long, k As Long, n As Long
  Dim Rng As Range
  Dim s As String, s1 As String, s2 As String
  Dim w1, w2
 
  ' Set data range A:D
  With ActiveSheet.UsedRange
    Set Rng = .Offset(1).Resize(.Rows.Count - 1).Columns("A:D")
  End With
 
  ' Normalize Dataset
  a() = Rng.Columns("B").Value
  For i = 1 To UBound(a)
    a(i, 1) = Join(TxtToArray(a(i, 1)))
  Next
 
  ' Disable screen updating
  Application.ScreenUpdating = False
 
  ' Sord Rng by Dataset
  With Rng
    .Columns("C").Value = a()
    .Sort .Cells(1, "C"), xlAscending, Header:=xlNo
  End With
 
  ' Convert normalized & sorted Dataset to array
  a() = Rng.Columns("C:D").Value
  For i = 1 To UBound(a)
    a(i, 2) = TxtToArray(a(i, 1))
  Next
 
  ' Do main
  ReDim b(1 To UBound(a), 1 To 2)
  i = 1
  j = i + 1
  Do
    s = vbNullString
    k = 0
    While a(i, 2)(k) = a(j, 2)(k)
      s = s & a(i, 2)(k) & " "
      k = k + 1
    Wend
    If k > 0 Then
      If k <= UBound(a(i, 2)) Then
        s1 = ""
        For n = k + 1 To UBound(a(i, 2))
          s1 = s1 & a(i, 2)(n) & " "
        Next
        s1 = RTrim$(s1)
        s2 = ""
        For n = k + 1 To UBound(a(j, 2))
          s2 = s2 & a(j, 2)(n) & " "
        Next
        s2 = RTrim$(s2)
        If Len(s1) > 0 And s1 = s2 Then
          If j = i + 1 Then b(i, 1) = s & s1 '
          b(j, 1) = b(i, 1)
          b(i, 2) = a(i, 2)(k)
          b(j, 2) = a(j, 2)(k)
        Else
          b(i, 1) = RTrim$(s)
          b(j, 1) = b(i, 1)
          b(i, 2) = a(i, 2)(k) & s1
          b(j, 2) = a(j, 2)(k) & s2
        End If
        j = j + 1
        If j <= UBound(a) Then
          If Not a(j, 1) Like s & "*" Then
            i = j
            j = i + 1
          End If
        End If
      Else
        b(i, 1) = a(i, 2)
        i = j
        j = i + 1
      End If
    Else
      b(i, 1) = a(i, 1)
      i = j
      j = i + 1
    End If
  Loop While j <= UBound(a)
 
  ' Create result
  Rng.Columns("C:D").Value = b()
 
  ' Sort Rng by UID
  With Rng
    .Sort .Cells(1, "A"), xlAscending, Header:=xlNo
  End With
 
  ' Enable screen updating
  Application.ScreenUpdating = True
 
End Sub
 
Function TxtToArray(Txt) As Variant
  Dim a, i As Long, j As Long, s As String
  Dim RegEx As Object
  If RegEx Is Nothing Then
    Set RegEx = CreateObject("VBScript.RegExp")
    RegEx.Global = True
    RegEx.Pattern = "[.,!?:;_\-]"
  End If
  s = RegEx.Replace(Txt, " ")
  If s Like "*(* *)*" Then
    i = InStr(s, "(")
    While i > 0
      j = InStr(i + 1, s, ")")
      If j > 1 Then
        s = Mid$(s, 1, i) & Replace(Mid$(s, i + 1, j - i - 1), " ", "") & Mid$(s, j)
        i = InStr(j + 1, s, "(")
      Else
        i = 0
      End If
    Wend
  End If
  a = Split(s)
  j = 0
  For i = 0 To UBound(a)
    If Len(a(i)) > 0 Then
      a(j) = a(i)
      j = j + 1
    End If
  Next
  If j - 1 < UBound(a) Then ReDim Preserve a(0 To j - 1)
  TxtToArray = a
End Function

The layout of input/output:
ABCD
exmp/00005SANTAS LITTLE HELPER (116cm)SANTAS LITTLE HELPER(116cm)
exmp/00006SANTAS LITTLE HELPER (128cm)SANTAS LITTLE HELPER(128cm)
exmp/00007SANTAS LITTLE HELPER (140cm)SANTAS LITTLE HELPER(140cm)
exmp/00008PETTICOAT WHITE - ONE SIZEPETTICOAT ONE SIZEWHITE
exmp/00009PETTICOAT RED - ONE SIZEPETTICOAT ONE SIZERED
exmp/00010PETTICOAT BLACK - ONE SIZEPETTICOAT ONE SIZEBLACK
exmp/00011DEATHLY GRIM REAPER (S)DEATHLY GRIM REAPER(S)
exmp/00012DEATHLY GRIM REAPER (M)DEATHLY GRIM REAPER(M)
exmp/00013DEATHLY GRIM REAPER (L)DEATHLY GRIM REAPER(L)
exmp/00014DEATHLY GRIM REAPER (XL)DEATHLY GRIM REAPER(XL)
exmp/00015COLOUR CHANGING CRYSTAL BALLCOLOUR CHANGING CRYSTAL BALL
exmp/00016DEATHLY GRIM REAPER (128cm)DEATHLY GRIM REAPER(128cm)
exmp/00017DEATHLY GRIM REAPER (140cm)DEATHLY GRIM REAPER(140cm)
exmp/00018DEATHLY GRIM REAPER (158cm)DEATHLY GRIM REAPER(158cm)
exmp/00021CAT (S)CAT(S)
exmp/00022CAT (M)CAT(M)
exmp/00023CAT (L)CAT(L)
exmp/00025HOLY MARY (116cm)HOLY MARY(116cm)
exmp/00026HOLY MARY (128cm)HOLY MARY(128cm)
exmp/00027HOLY MARY (140cm)HOLY MARY(140cm)

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="bgcolor: #E2EFDA"]UID[/TD]
[TD="bgcolor: #E2EFDA"]Dataset 1[/TD]
[TD="bgcolor: #E2EFDA"]Parent (normalized)[/TD]
[TD="bgcolor: #E2EFDA"]Child (normalized)[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]5[/TD]

[TD="align: center"]6[/TD]

[TD="align: center"]7[/TD]

[TD="align: center"]8[/TD]

[TD="align: center"]9[/TD]

[TD="align: center"]10[/TD]

[TD="align: center"]11[/TD]

[TD="align: center"]12[/TD]

[TD="align: right"][/TD]

[TD="align: center"]13[/TD]

[TD="align: center"]14[/TD]

[TD="align: center"]15[/TD]

[TD="align: center"]16[/TD]

[TD="align: center"]17[/TD]

[TD="align: center"]18[/TD]

[TD="align: center"]19[/TD]

[TD="align: center"]20[/TD]

[TD="align: center"]21[/TD]

</tbody>
Sheet1


Regards

Wow! :biggrin: I'm trying it now. Initially I ran this over the entire dataset which is over 25,000 lines and it eventually stopped with an error that needed debug. I'm guessing though it was just too large. I'll try it over smaller subsets and get back to you with results! Thank you ever so much for making such an effort for me, it is much appreciated. :cool:
 
Upvote 0
Wow! :biggrin: I'm trying it now. Initially I ran this over the entire dataset which is over 25,000 lines and it eventually stopped with an error that needed debug. I'm guessing though it was just too large. I'll try it over smaller subsets and get back to you with results! Thank you ever so much for making such an effort for me, it is much appreciated. :cool:

Okay, so debug message is "runtime error '9' subscript out of range" and the debug highlights;

While a(i, 2)(k) = a(j, 2)(k)

I tried over a range of 1,000 and then over 100 rows just to make sure. Same error message "runtime error '9' subscript out of range. I'm running in same input/output format of coumns A through D. Any idea what I might be doing wrong? :confused:
 
Upvote 0
Code was developed for the posted data structure. And it works with it - try using the posted data.
There is no limitation in amount of data rows for the code.
The below is a bit enhanced version for some other data structures.
If it does not work then you may send me actual (not sensitive) data for testing other structures - just PM me to get my email.
Rich (BB code):
Option Explicit
Option Compare Text
 
Sub Main()
 
  Dim a(), b()
  Dim i As Long, j As Long, k As Long, n As Long, m As Long
  Dim Rng As Range
  Dim s As String, s1 As String, s2 As String
 
  ' Set data range A:D
  With ActiveSheet.UsedRange
    Set Rng = .Offset(1).Resize(.Rows.Count - 1).Columns("A:D")
  End With
 
  ' Normalize Dataset
  a() = Rng.Columns("B").Value
  For i = 1 To UBound(a)
    a(i, 1) = Join(TxtToArray(a(i, 1)))
  Next
 
  ' Disable screen updating
  Application.ScreenUpdating = False
 
  ' Sord Rng by Dataset
  With Rng
    .Columns("C").Value = a()
    .Sort .Cells(1, "C"), xlAscending, Header:=xlNo
  End With
 
  ' Convert normalized & sorted Dataset to array
  a() = Rng.Columns("C:D").Value
  For i = 1 To UBound(a)
    a(i, 2) = TxtToArray(a(i, 1))
  Next
 
  ' Do main
  ReDim b(1 To UBound(a), 1 To 2)
  i = 1
  j = i + 1
  Do
    s = vbNullString
    k = 0
    m = UBound(a(i, 2))
    If m > UBound(a(j, 2)) Then m = UBound(a(j, 2))
'    While a(i, 2)(k) = a(j, 2)(k)
'      s = s & a(i, 2)(k) & " "
'      k = k + 1
'    Wend
    Do
      If a(i, 2)(k) = a(j, 2)(k) Then
        s = s & a(i, 2)(k) & " "
        k = k + 1
      Else
        Exit Do
      End If
    Loop While k <= m
   
    If k > 0 Then
      If k <= UBound(a(i, 2)) Then
        s1 = ""
        For n = k + 1 To UBound(a(i, 2))
          s1 = s1 & a(i, 2)(n) & " "
        Next
        s1 = RTrim$(s1)
        s2 = ""
        For n = k + 1 To UBound(a(j, 2))
          s2 = s2 & a(j, 2)(n) & " "
        Next
        s2 = RTrim$(s2)
        If Len(s1) > 0 And s1 = s2 Then
          If j = i + 1 Then b(i, 1) = s & s1 '
          b(j, 1) = b(i, 1)
          b(i, 2) = a(i, 2)(k)
          b(j, 2) = a(j, 2)(k)
        Else
          b(i, 1) = RTrim$(s)
          b(j, 1) = b(i, 1)
          b(i, 2) = a(i, 2)(k) & s1
          b(j, 2) = a(j, 2)(k) & s2
        End If
        j = j + 1
        If j <= UBound(a) Then
          If Not a(j, 1) Like s & "*" Then
            i = j
            j = i + 1
          End If
        End If
      Else
        b(i, 1) = a(i, 1)
        If UBound(a(j, 2)) > UBound(a(i, 2)) Then
          b(j, 1) = s
          b(j, 2) = a(j, 2)(k) & s2
        Else
          b(j, 1) = a(j, 1)
        End If
        i = j
        j = i + 1
      End If
    Else
      b(i, 1) = a(i, 1)
      i = j
      j = i + 1
    End If
  Loop While j <= UBound(a)
 
  ' Create result
  Rng.Columns("C:D").Value = b()
 
  ' Sort Rng by UID
  With Rng
    .Sort .Cells(1, "A"), xlAscending, Header:=xlNo
  End With
 
  ' Enable screen updating
  Application.ScreenUpdating = True
 
End Sub
 
Function TxtToArray(Txt) As Variant
  Dim a, i As Long, j As Long, s As String
  Dim RegEx As Object
  If RegEx Is Nothing Then
    Set RegEx = CreateObject("VBScript.RegExp")
    RegEx.Global = True
    RegEx.Pattern = "[.,!?:;_\-]"
  End If
  s = RegEx.Replace(Txt, " ")
  If s Like "*(* *)*" Then
    i = InStr(s, "(")
    While i > 0
      j = InStr(i + 1, s, ")")
      If j > 1 Then
        s = Mid$(s, 1, i) & Replace(Mid$(s, i + 1, j - i - 1), " ", "") & Mid$(s, j)
        i = InStr(j + 1, s, "(")
      Else
        i = 0
      End If
    Wend
  End If
  a = Split(s)
  j = 0
  For i = 0 To UBound(a)
    If Len(a(i)) > 0 Then
      a(j) = a(i)
      j = j + 1
    End If
  Next
  If j - 1 < UBound(a) Then ReDim Preserve a(0 To j - 1)
  TxtToArray = a
End Function
 
Upvote 0
Code was developed for the posted data structure. And it works with it - try using the posted data.
There is no limitation in amount of data rows for the code.
The below is a bit enhanced version for some other data structures.
If it does not work then you may send me actual (not sensitive) data for testing other structures - just PM me to get my email.
Rich (BB code):
Option Explicit
Option Compare Text
 
Sub Main()
 
  Dim a(), b()
  Dim i As Long, j As Long, k As Long, n As Long, m As Long
  Dim Rng As Range
  Dim s As String, s1 As String, s2 As String
 
  ' Set data range A:D
  With ActiveSheet.UsedRange
    Set Rng = .Offset(1).Resize(.Rows.Count - 1).Columns("A:D")
  End With
 
  ' Normalize Dataset
  a() = Rng.Columns("B").Value
  For i = 1 To UBound(a)
    a(i, 1) = Join(TxtToArray(a(i, 1)))
  Next
 
  ' Disable screen updating
  Application.ScreenUpdating = False
 
  ' Sord Rng by Dataset
  With Rng
    .Columns("C").Value = a()
    .Sort .Cells(1, "C"), xlAscending, Header:=xlNo
  End With
 
  ' Convert normalized & sorted Dataset to array
  a() = Rng.Columns("C:D").Value
  For i = 1 To UBound(a)
    a(i, 2) = TxtToArray(a(i, 1))
  Next
 
  ' Do main
  ReDim b(1 To UBound(a), 1 To 2)
  i = 1
  j = i + 1
  Do
    s = vbNullString
    k = 0
    m = UBound(a(i, 2))
    If m > UBound(a(j, 2)) Then m = UBound(a(j, 2))
'    While a(i, 2)(k) = a(j, 2)(k)
'      s = s & a(i, 2)(k) & " "
'      k = k + 1
'    Wend
    Do
      If a(i, 2)(k) = a(j, 2)(k) Then
        s = s & a(i, 2)(k) & " "
        k = k + 1
      Else
        Exit Do
      End If
    Loop While k <= m
   
    If k > 0 Then
      If k <= UBound(a(i, 2)) Then
        s1 = ""
        For n = k + 1 To UBound(a(i, 2))
          s1 = s1 & a(i, 2)(n) & " "
        Next
        s1 = RTrim$(s1)
        s2 = ""
        For n = k + 1 To UBound(a(j, 2))
          s2 = s2 & a(j, 2)(n) & " "
        Next
        s2 = RTrim$(s2)
        If Len(s1) > 0 And s1 = s2 Then
          If j = i + 1 Then b(i, 1) = s & s1 '
          b(j, 1) = b(i, 1)
          b(i, 2) = a(i, 2)(k)
          b(j, 2) = a(j, 2)(k)
        Else
          b(i, 1) = RTrim$(s)
          b(j, 1) = b(i, 1)
          b(i, 2) = a(i, 2)(k) & s1
          b(j, 2) = a(j, 2)(k) & s2
        End If
        j = j + 1
        If j <= UBound(a) Then
          If Not a(j, 1) Like s & "*" Then
            i = j
            j = i + 1
          End If
        End If
      Else
        b(i, 1) = a(i, 1)
        If UBound(a(j, 2)) > UBound(a(i, 2)) Then
          b(j, 1) = s
          b(j, 2) = a(j, 2)(k) & s2
        Else
          b(j, 1) = a(j, 1)
        End If
        i = j
        j = i + 1
      End If
    Else
      b(i, 1) = a(i, 1)
      i = j
      j = i + 1
    End If
  Loop While j <= UBound(a)
 
  ' Create result
  Rng.Columns("C:D").Value = b()
 
  ' Sort Rng by UID
  With Rng
    .Sort .Cells(1, "A"), xlAscending, Header:=xlNo
  End With
 
  ' Enable screen updating
  Application.ScreenUpdating = True
 
End Sub
 
Function TxtToArray(Txt) As Variant
  Dim a, i As Long, j As Long, s As String
  Dim RegEx As Object
  If RegEx Is Nothing Then
    Set RegEx = CreateObject("VBScript.RegExp")
    RegEx.Global = True
    RegEx.Pattern = "[.,!?:;_\-]"
  End If
  s = RegEx.Replace(Txt, " ")
  If s Like "*(* *)*" Then
    i = InStr(s, "(")
    While i > 0
      j = InStr(i + 1, s, ")")
      If j > 1 Then
        s = Mid$(s, 1, i) & Replace(Mid$(s, i + 1, j - i - 1), " ", "") & Mid$(s, j)
        i = InStr(j + 1, s, "(")
      Else
        i = 0
      End If
    Wend
  End If
  a = Split(s)
  j = 0
  For i = 0 To UBound(a)
    If Len(a(i)) > 0 Then
      a(j) = a(i)
      j = j + 1
    End If
  Next
  If j - 1 < UBound(a) Then ReDim Preserve a(0 To j - 1)
  TxtToArray = a
End Function

That (almost) worked! Took a while to run. It seems to be struggling with items that contain more than one set of brackets in a cell. I'll PM you for email and send you the file to see if you can spot the problem. Very close to working though!
 
Upvote 0
There have been so many amazing solutions proposed. Would a simpler approach be considered? Create a lookup tab consisting of the product and name to use, then do a simple VLOOKUP. This would entail maintenance as new products occur, but it may be more accurate in the long run.
[TABLE="class: grid, width: 700"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Product[/TD]
[TD]NameToUse[/TD]
[/TR]
[TR]
[TD]COLOUR CHANGING CRYSTAL BALL[/TD]
[TD]COLOUR CHANGING CRYSTAL BALL[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (128cm)[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (140cm)[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (158cm)[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (L)[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (M)[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (S)[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]DEATHLY GRIM REAPER (XL)[/TD]
[TD]DEATHLY GRIM REAPER[/TD]
[/TR]
[TR]
[TD]PETTICOAT BLACK - ONE SIZE[/TD]
[TD]PETTICOAT - ONE SIZE[/TD]
[/TR]
[TR]
[TD]PETTICOAT RED - ONE SIZE[/TD]
[TD]PETTICOAT - ONE SIZE[/TD]
[/TR]
[TR]
[TD]PETTICOAT WHITE - ONE SIZE[/TD]
[TD]PETTICOAT - ONE SIZE[/TD]
[/TR]
[TR]
[TD]SANTAS LITTLE HELPER (116cm)[/TD]
[TD]SANTAS LITTLE HELPER[/TD]
[/TR]
[TR]
[TD]SANTAS LITTLE HELPER (128cm)[/TD]
[TD]SANTAS LITTLE HELPER[/TD]
[/TR]
[TR]
[TD]SANTAS LITTLE HELPER (140cm)[/TD]
[TD]SANTAS LITTLE HELPER[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,224,755
Messages
6,180,751
Members
452,996
Latest member
nelsonsix66

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