VBA code for Text Diff between two columns?

Akila868

New Member
Joined
Aug 28, 2019
Messages
8
Hi friends,

I need big help on the following.

I have two columns with texts. Column A has the old text and Column B has the new text. I need to match these two and show in a 3rd column the additional characters (highlighted in red color) in B column compared to A column text. Further in D column to show the additional characters separately.

Would really appreciate if this can be done. Thanks in advance. :)
Ex.

Column A
Column B
Column C
Column D
Test123$ New.
Test123E Newest
Test123E Newest
Eest

<tbody>
</tbody>
 
Here's the result I got, it isn't what you expected?
Column AColumn B
ABC$123.ABCU123.ABCU123.U
DDD;889@DDDL889PDDDL889PLP
DustinDuxtinxDuxtinxxx

<tbody>
</tbody>

Yes. But this is what I am getting. I used in some other data I had.

Column AColumn BColumn CColumn D
Testing Medical Institute Ltd.Testing Medical Institute LimitedTesting Medical Institute Limited
imited
Lester Mango Exports LLcLester Mang Exports, LLcLester Mang Exports, LLc
Exports,

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Your new example, that's a different story, sorry I don't know how amend the code to deal with such case.:confused:
Hope someone else would step in.
 
Upvote 0
The reply given by Akuini is what you expected as per your previous post.
But I understand that you want something else.
Please give some explanations.

You have mentioned :
'Just need to compare character by character from left to right in the same order and display difference in characters.'

The original text is displayed in Column C.
The differences in characters are shown in color in Column C.
The additions are shown in Column D.
Do you want just to display in Column C the differences in characters shown in color omiting the original Text?

You have mentioned :
'It should instead highlight the characters that came in new/ removed/ replaced by comparing the two words in two columns.'

The characters that came in new are shown in red along with the original text in Column C.
What else do you want?

Do you want just to display the characters that are removed?
If so, in which column?
How, in Red or in Black?
With the Original text or without?

Do you want just to display the characters that are replaced?
If so, in which column?
How, in Red or in Black?

It will be good if you give an example of the original text in Column A, the modified text in Column B, along with what all you want to be displayed in what columns and in what colors.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,247
Members
448,879
Latest member
oksanana

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