List of unique characters from a list

ollyhughes1982

Well-known Member
Joined
Nov 27, 2018
Messages
793
Office Version
  1. 365
Platform
  1. MacOS
Hi,

This is the formula I have been using to get unique list of characters from a a list of names in column A. Is there a reason that it won't work for more than around a 1,000 rows? I get a CALC! ("CONCAT: Text too long") error. I'd like to do it for 10,000 rows.

=LET(u,UNIQUE(FILTER(A2:A1001,A2:A1001<>"")),UNICHAR(UNIQUE(UNICODE(MID(CONCAT(u),SEQUENCE(LEN(CONCAT(u))),1)))))

Finding it a pain to keep having to repeatedly chop my list into smaller chunks.

Thanks in advance!

Olly.
 
Last edited:
I just want every unique character that appears in A2:10001, as per the list above. There would initially be a mix of cases, but I want the final list to be UPPER.
Do you have a master list of all the characters or it changes based on the input in A?
 
Upvote 0

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.
Do you have a master list of all the characters or it changes based on the input in A?
Have you had a look at the file? I just have a list of event names in column a and want to have every unique character that appears anywhere in those rows in column B, or in another sheet. it doesn't matter where.
 
Upvote 0
I have just found the original question I posed, around 2 years ago:


This works up to a point, but I now have to keep breaking it down into smaller ranges.
 
Upvote 0
Have you had a look at the file? I just have a list of event names in column a and want to have every unique character that appears anywhere in those rows in column B, or in another sheet. it doesn't matter where.
I have but wanted to see if you had one to workaround the character limit.

I have just found the original question I posed, around 2 years ago:


This works up to a point, but I now have to keep breaking it down into smaller ranges.
I can offer a VBA solution if you're interested in.
 
Upvote 0
I have but wanted to see if you had one to workaround the character limit.


I can offer a VBA solution if you're interested in.
Possibly, but I've had issues with it in the Mac previously, so it may not work.
 
Upvote 0
See if this works for you.
VBA Code:
Sub UniqueCharactersAcrossCells()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("Unique Characters")
    Dim lastRow As Long
    Dim i As Long, j As Long
    Dim inputData As Variant
    Dim char As String
    Dim uniqueChars As Collection
    Dim outputArray() As String
    
    Set uniqueChars = New Collection
    
    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
    inputData = ws.Range("A3:A" & lastRow).Value
    
    On Error Resume Next
    For i = 1 To UBound(inputData, 1)
        For j = 1 To Len(inputData(i, 1))
            char = Mid(inputData(i, 1), j, 1)
            If Len(char) > 0 Then
                uniqueChars.Add char, char
            End If
        Next j
    Next i
    On Error GoTo 0
    
    ReDim outputArray(1 To uniqueChars.Count, 1 To 1)
    For i = 1 To uniqueChars.Count
        outputArray(i, 1) = uniqueChars(i)
    Next i
    
    ws.Range("B3").Resize(UBound(outputArray, 1), 1).Value = outputArray
End Sub
 
Upvote 0
See if this works for you.
VBA Code:
Sub UniqueCharactersAcrossCells()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("Unique Characters")
    Dim lastRow As Long
    Dim i As Long, j As Long
    Dim inputData As Variant
    Dim char As String
    Dim uniqueChars As Collection
    Dim outputArray() As String
   
    Set uniqueChars = New Collection
   
    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
    inputData = ws.Range("A3:A" & lastRow).Value
   
    On Error Resume Next
    For i = 1 To UBound(inputData, 1)
        For j = 1 To Len(inputData(i, 1))
            char = Mid(inputData(i, 1), j, 1)
            If Len(char) > 0 Then
                uniqueChars.Add char, char
            End If
        Next j
    Next i
    On Error GoTo 0
   
    ReDim outputArray(1 To uniqueChars.Count, 1 To 1)
    For i = 1 To uniqueChars.Count
        outputArray(i, 1) = uniqueChars(i)
    Next i
   
    ws.Range("B3").Resize(UBound(outputArray, 1), 1).Value = outputArray
End Sub
Thanks. This will work for a list starting in A2 and populate B2 downwards?
 
Upvote 0
See if this works for you.
VBA Code:
Sub UniqueCharactersAcrossCells()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("Unique Characters")
    Dim lastRow As Long
    Dim i As Long, j As Long
    Dim inputData As Variant
    Dim char As String
    Dim uniqueChars As Collection
    Dim outputArray() As String
   
    Set uniqueChars = New Collection
   
    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
    inputData = ws.Range("A3:A" & lastRow).Value
   
    On Error Resume Next
    For i = 1 To UBound(inputData, 1)
        For j = 1 To Len(inputData(i, 1))
            char = Mid(inputData(i, 1), j, 1)
            If Len(char) > 0 Then
                uniqueChars.Add char, char
            End If
        Next j
    Next i
    On Error GoTo 0
   
    ReDim outputArray(1 To uniqueChars.Count, 1 To 1)
    For i = 1 To uniqueChars.Count
        outputArray(i, 1) = uniqueChars(i)
    Next i
   
    ws.Range("B3").Resize(UBound(outputArray, 1), 1).Value = outputArray
End Sub
I ran it and nothing seemed to happen. Didn't get any errors though
 
Upvote 0

Forum statistics

Threads
1,223,878
Messages
6,175,141
Members
452,615
Latest member
bogeys2birdies

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