Can I remove duplicates from a CELL?

sewercider

New Member
Joined
Oct 22, 2018
Messages
7
I have a spreadsheet with a few hundred URLs in it, but for whatever reason they have all doubled up.

For example, A1 looks like:

"https://website.comhttps://website.com"

Is there a way I can clean this up?

Kind regards
 
Last edited by a moderator:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Can't access the link you provided, but have you tried

Select the range of cells, or ensure that the active cell is in a table.
On the Data tab, click Remove Duplicates (in the Data Tools group).
Click OK
 
Upvote 0
Sorry just to clarify - the URLS are duplicated, back to back, in the same cell (ie. google.comgoogle.com) - am wondering how I can remove the trailing duplicate?!
 
Upvote 0
I can't access the link but somesample would help ???
 
Upvote 0
There is no link as such - the problem is that the URL is literally duplicated in each cell! Have mocked up below. Thanks for taking a look :)

o3F2aRS.jpg
 
Upvote 0
I think you'll need a UDF for this.
This modified from a post by J.Fox

Code:
Function RD(dString As String) As String
Dim x As Long, ct As Long, str As String
str = Trim(Left(dString, WorksheetFunction.RoundUp((Len(dString) - 1) / 2, 0)))
For x = 1 To Len(dString)
    If Mid(dString, x, Len(str)) = str Then ct = ct + 1
Next x
If ct > 1 Then
    RD = str
Else
    RD = "#N/A"
End If
End Function

Excel 2007
AB
1google.comgoogle.comgoogle.com
2msn.commsn.commsn.com
3yahoo.com.yahoo.comyahoo.com
Sheet1
Cell Formulas
RangeFormula
B1=RD(A1)
B2=RD(A2)
B3=RD(A3)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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