vba - remove duplicates in a text string

monsierexcel

New Member
Joined
Nov 19, 2018
Messages
29
i have a string that has produced duplicate words

AC2 >"test grey grey white black white" what i want to produce> "test grey white black"
AC3> "blue green green black white black" what i want to produce> "blue green black white"

is there a way in VBA to remove duplicate words out of a string and present in the info as a formula for each row?
i have seen a function available to handle this but not sure how i present these functions for each row?

thank you guys
 
As this is a totally different question, please start a new thread. Thanks
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Is there any easy way to account for commas?

For example: 10.1, 10.2, 10.3, 10.4, 10.1, 10.2, 10.3
output with this code is: 10.1, 10.2, 10.3, 10.4, 10.3 because there is no comma after the second 10.3 it does not register as a duplicate.

I want the output to remove the last number and the commas. So, essentially, I want the code to remove the number and any following commas.
 
Upvote 0
Hi & welcome to MrExcel.
Please start a thread of your own for this question. Thanks
 
Upvote 0

Forum statistics

Threads
1,216,474
Messages
6,130,841
Members
449,598
Latest member
sunny_ksy

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