Copy unique values only from a single cell

eeb

New Member
Joined
Sep 17, 2021
Messages
14
Office Version
  1. 2016
Platform
  1. MacOS
Hello,

I have a list of values separated by a hard return in a single cell, and want to copy only the unique values into a list in another cell.

Please let me know any additional information that would be required.

The initial lists are of variable length, (3-100 values). and the value is a text string of 3-40 characters. The values occur anywhere from once, to 8 times in the list.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Maybe like this(put this behind a module)

VBA Code:
Function jec(cell As String) As String
  With CreateObject("scripting.dictionary")
    For Each it In Split(cell, Chr(10))
       c00 = .Item(it)
    Next
    jec = Join(.keys)
  End With
End Function

You can call this function as
Excel Formula:
=jec(A1)
 
Upvote 0
Maybe like this(put this behind a module)

VBA Code:
Function jec(cell As String) As String
  With CreateObject("scripting.dictionary")
    For Each it In Split(cell, Chr(10))
       c00 = .Item(it)
    Next
    jec = Join(.keys)
  End With
End Function

You can call this function as
Excel Formula:
=jec(A1)
any chance you know the GSheet conversion for this ? I used textjoin so I switched to GSheet.

thanks!!
 
Upvote 0

Forum statistics

Threads
1,223,990
Messages
6,175,817
Members
452,672
Latest member
missbanana

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