Help in removing duplicate strings in cell without macros/VBA

xcellerator

New Member
Joined
Feb 22, 2017
Messages
23
Office Version
  1. 2019
Platform
  1. MacOS
I have a number of cells and I am looking to remove the duplicate strings (2 characters or more) in them.
Is this possible with an existing Excel formula(s)? It's ok if I need to use helper columns (C, D, E...)

For example:
A1 = Jane & Bob Smith Smith
A2 = Joe Johnson Johnson
A3 = Sally and Bill Jones
A4 = Ann and Tim Adams Adams
A5 = Ben

then have a formula to convert into
B1 = Jane & Bob Smith
B2 = Joe Johnson
B3 = Sally and Bill Jones
B4 = Ann and Tim Adams
B5 = Ben

Can I do this without any macros/VBA?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
If the duplicated words are always the last and second last words :

=IF(TRIM(LEFT(RIGHT(" "&SUBSTITUTE(TRIM(A1)," ",REPT(" ",60)),120),60))=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",100)),100)),LEFT(A1,LOOKUP(2^15,FIND(" "," "&A1,ROW(INDIRECT("1:"&LEN(A1)))))-1),A1)
 
Upvote 0
Hi,

Also assuming the duplicate word, if any, is always the Last word:


Book1
AB
1Jane & Bob Smith SmithJane & Bob Smith
2Joe Johnson JohnsonJoe Johnson
3Sally and Bill JonesSally and Bill Jones
4Ann and Tim Adams AdamsAnn and Tim Adams
5BenBen
Sheet291
Cell Formulas
RangeFormula
B1=TRIM(SUBSTITUTE(A1,TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99)),"",2))


Formula copied down.
 
Upvote 0
My error in initial question!

Is there a way to do this if the word is not always the last word?
I have cases such as "Jane Smith & Bob Smith", which would want to turn into "Jane & Bob Smith" (so basically remove the 1st occurrence of the word is best).
 
Upvote 0
So, are you saying you have Some strings as described in OP Post # 1, AND, you have Some strings as described above ( Post # 4 )?? That BOTH types of strings are possible, so sometimes you need the First duplicate removed, but sometimes you need the Second duplicate removed ??
 
Upvote 0
Actually always only the first string needs to be removed. Sorry for lack of clarity!
 
Upvote 0
But you might still have strings like below as shown in OP, where there's No duplicate, is that correct ?

A3 = Sally and Bill Jones
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

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