Delete duplicate data in a single cell

K

kacey28

I have a spreadsheet provided by an outsourced company that has duplicate
data within a single cell. For example, a cell with Name values will have
"Jerry White Jerry White" (twice), rather than once "Jerry White".

When duplicate values appear in the same cell, how do you manage to clean
these up without manually deleting data in each individual cell? (Note - I
have several columns that contain various duplicated data.)

Thanks in advance for any help!
 
R

ryguy7272

I think this will work for you:
=LEFT(A1,FIND(" ",A1,1)-1)&RIGHT(A1,FIND(" ",A1,1)+2)


Regards,
Ryan---
 
D

Dave

Hi,
This is a bit long-winded, but it's all I could think of.
With the data to be examined in A2:

=IF(MOD(LEN(A2),2)=1,IF(LEFT(A2,(LEN(A2)-1)/2)=RIGHT(A2,(LEN(A2)-1)/2),LEFT(A2,(LEN(A2)-1)/2),A2),A2)

Copy down as required.
Regards - Dave.
 
K

kacey28

Thank you, ryguy7272.

I tried the formula supplied and here's the result:

Field A1 data: CRYSTAL BERNIER CRYSTAL BERNIER

Field A1 data (after formula): CRYSTALAL BERNIER

As you can see, the formula sucessfully removed the duplicate first/last
name, however, it added additional letters to the first name. This occured
in the subsequent list fields as well. Any way to get it to display just the
unique name value without the additional letters?
 
K

kacey28

Thank you, Dave. Your formula returned the same value as in the original
cell (i.e. duplicate data).
 
K

kacey28

Ryan - additional information. I finally disected your formula to understand
you are giving the find function a starting position within the text of the
field.

Would this formula work when there are variying duplicate names, or other
values, that each have seperate starting positions withing the text
throughout a column?
 
D

Dave

Hi,
My formula works ok for me. Try typing Jerry White Jerry White into A2 and
apply the formula.
Does your data have leading or trailing spaces that you're not telling us
about?
Regards - Dave.
 
N

Nita Carmicle

Have you tried 'Text to Column"? If you go to Data and select 'Text to
Columns' it will sort each first and last name into separate columns and you
can delete the unnecessary columns. This is just a quick fix, but it works.
 
K

kacey28

Thank you, Nita.

Nita Carmicle said:
Have you tried 'Text to Column"? If you go to Data and select 'Text to
Columns' it will sort each first and last name into separate columns and you
can delete the unnecessary columns. This is just a quick fix, but it works.
 
K

kacey28

Dave, I wasn't aware spaces could cause a problem. Yes, the format that the
outsourced company uses in thier spreadsheet does include unnecessary leading
and trailing spaces.

Would it work best if I run the Trim function and then run your formula from
the clean data?
 
D

Dave

Hi KC,
The formula I suggested counts the characters, then compares the first half
to the second half. If there are extra spaces, they mess up the count.

You can clean up your data with =TRIM(SUBSTITUTE(A2,CHAR(160)," "))
Put this in an adjacent cell, then copy down. It will remove leading and
trailing spaces, and the nasty non-breaking space character which is
sometimes present.
Then apply my other formula to cleaned-up data.
If it gives you what you want, copy the good data and Paste Special > Values
over the original data, and delete the columns you used in the process.
Regards - Dave.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top