Hi AlphaFrog,
Once again cheers for the amazing code (I forgot to mention that last time).
The code looks great. I have a few changes I would like to make:
3. I meant that instead of having a deletions or additions column (which is great to visually see), I was wondering if there's a code that synthesizes the information, so that the output is: all the school names, with deletions (strike through), additions (italicized), and repeats (no change = normal).
4. Each school is separated (for the additions/deletions column). I think they just come as a list without any separation technique. So either each has its own line within the cell or separated by a column. Perhaps a comma could replace the double parenthetical.
Examples to go with the above:
3: Synthesized information:
B6=[TABLE="class: cms_table, width: 110"]
<tbody>[TR]
[TD="class: cms_table_xl64, width: 110"]Med Col of Georgia (1) (AC) Morehouse (1) (AC)[/TD]
[/TR]
</tbody>[/TABLE]
D6=
[TABLE="class: cms_table, width: 110"]
<tbody>[TR]
[TD="class: cms_table_xl66, width: 110"]Med Col of Georgia (1) (AC) Meharry (1) (AC)[/TD]
[/TR]
</tbody>[/TABLE]
Deletions
G6 =WORDDIF(D6,B6)[TABLE="class: cms_table, width: 70"]
<tbody>[TR]
[TD="class: cms_table_xl66"]Meharry[/TD]
[/TR]
</tbody>[/TABLE]
Additions
H6 = =WORDDIF(B6,D6)
[TABLE="class: cms_table, width: 82"]
<tbody>[TR]
[TD="class: cms_table_xl66, width: 82"]Morehouse[/TD]
[/TR]
</tbody>[/TABLE]
I6 = {new code or something}
[TABLE="width: 110"]
<tbody>[TR]
[TD="class: xl64, width: 110"]Med Col of Georgia,
Morehouse,
Meharry*[/TD]
[/TR]
</tbody>[/TABLE]
*Note: I couldn't figure out how to strike through Meharry, so I underlined it.
Also note that there are commas separating the schools in the final list. Perhaps this could be done with replacing the set of parenthetical by commas.
4. Schools separated
B91 =
[TABLE="width: 110"]
<tbody>[TR]
[TD="class: xl66, width: 110"]Columbia (1) (AC)
Northwestern (1) (AC) Southern Calif (1) (AC)
U Chicago-Pritzker (1) (AC) U Michigan (1) (AC)
Wash U St Louis (1) (AC)[/TD]
[/TR]
</tbody>[/TABLE]
D91 =
[TABLE="width: 110"]
<tbody>[TR]
[TD="class: xl66, width: 110"]Northwestern (1) (AC) Southern Calif (1) (AC)
U Chicago-Pritzker (1) (AC) U Michigan (1) (AC)[/TD]
[/TR]
</tbody>[/TABLE]
H91 ==WORDDIF(B91,D91)
[TABLE="width: 82"]
<tbody>[TR]
[TD="class: xl66, width: 82"]Columbia Wash U St Louis[/TD]
[/TR]
</tbody>[/TABLE]
{improved version}
H91 ==WORDDIF(B91,D91)
[TABLE="width: 82"]
<tbody>[TR]
[TD="class: xl66, width: 82"]Columbia
Wash U St Louis[/TD]
[/TR]
</tbody>[/TABLE]
OR
[TABLE="width: 82"]
<tbody>[TR]
[TD="class: xl66, width: 82"]Columbia, Wash U St Louis
[/TD]
[/TR]
</tbody>[/TABLE]
Note the spaces in the first example and the comma in the second.
Cheers for all your assistance.
Also, I've done a bit of coding back in the day. While I am a bit rusty, it would be nice to learn how to code for Excel. If you have any pointers or resources, that would be helpful.
Based on your examples:
1. In the data, the difference in number of lines (linefeed characters) created words that "looked" the same but one included a hidden a linefeed. The code below strips linefeed characters.
2. Modified code excludes all parentheticals
3. That's just a column font format. It has nothing to do with the code.
Code:
[COLOR=darkblue]Function[/COLOR] WORDDIF(rngA [COLOR=darkblue]As[/COLOR] Range, rngB [COLOR=darkblue]As[/COLOR] Range) [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]String[/COLOR]
[COLOR=green]'Remove linefeed characters and exclude parentheticals[/COLOR]
[COLOR=darkblue]Dim[/COLOR] WordsA [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Variant[/COLOR], WordsB [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Variant[/COLOR]
[COLOR=darkblue]Dim[/COLOR] ndxA [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR], ndxB [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR], strTemp As [COLOR=darkblue]String[/COLOR]
WordsA = Split(Replace(rngA.Text, vbLf, " "), " ") [COLOR=green]'remove linefeed[/COLOR]
WordsB = Split(Replace(rngB.Text, vbLf, " "), " ") [COLOR=green]'remove linefeed[/COLOR]
[COLOR=darkblue]For[/COLOR] ndxB = [COLOR=darkblue]LBound[/COLOR](WordsB) [COLOR=darkblue]To[/COLOR] [COLOR=darkblue]UBound[/COLOR](WordsB)
[COLOR=darkblue]For[/COLOR] ndxA = [COLOR=darkblue]LBound[/COLOR](WordsA) [COLOR=darkblue]To[/COLOR] [COLOR=darkblue]UBound[/COLOR](WordsA)
[COLOR=darkblue]If[/COLOR] [COLOR=darkblue]StrComp[/COLOR](WordsA(ndxA), WordsB(ndxB), vbTextCompare) = 0 [COLOR=darkblue]Then[/COLOR]
WordsA(ndxA) = vbNullString
[COLOR=darkblue]Exit[/COLOR] [COLOR=darkblue]For[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
[COLOR=darkblue]Next[/COLOR] ndxA
[COLOR=darkblue]Next[/COLOR] ndxB
[COLOR=darkblue]For[/COLOR] ndxA = [COLOR=darkblue]LBound[/COLOR](WordsA) [COLOR=darkblue]To[/COLOR] [COLOR=darkblue]UBound[/COLOR](WordsA)
[COLOR=green]'Exclude parentheticals[/COLOR]
[COLOR=darkblue]If[/COLOR] [COLOR=darkblue]Not[/COLOR] WordsA(ndxA) [COLOR=darkblue]Like[/COLOR] "(*)" [COLOR=darkblue]Then[/COLOR] strTemp = strTemp & WordsA(ndxA) & " "
[COLOR=darkblue]Next[/COLOR] ndxA
WORDDIF = Application.Trim(strTemp)
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Function[/COLOR]