Deleting repeating text from a column where each cell in the column has multiple text phrases

pbhogal

New Member
Joined
Oct 24, 2004
Messages
29
Platform
  1. Windows

deleting repeating text from a column where each cell in the column has multiple text phrases

Hi

I have an excel file with a column that has over 500 cells. Each cell has multiple text phrases in it seperated by a comma or a semi-colon. What I would like to do is delete all the recurring phrases in the column as a whole so that I am left with text in a new column that has only the unique text phrases in it as identified from the original 500 cells.

Can someone help in this regard?

THanks.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi,

To make it more clear, could you please attach screenshots with examples showing data before & data after?
 
Upvote 0
This might also help:
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

However, assuming data in column A, starting in row 2 & results in column B, you could try this with a copy of your data.

VBA Code:
Sub Phrases1()
  Dim a As Variant, b As Variant, itm As Variant
  Dim i As Long, k As Long
  
  a = Range("A2", Range("A" & Rows.Count).End(xlUp)).Value
  ReDim b(1 To Rows.Count, 1 To 1)
  For i = 1 To UBound(a)
    For Each itm In Split(Replace(a(i, 1), ",", ";"), ";")
      k = k + 1
      b(k, 1) = Trim(itm)
    Next itm
  Next i
  With Range("B2").Resize(k)
    .Value = b
    .RemoveDuplicates 1, xlNo
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

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