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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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,224,795
Messages
6,180,995
Members
453,011
Latest member
Osamu9Dazai

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