Function GetItemSize(value As String, Optional separator As String = ",") | |
Dim DedupeArray As Variant | |
DedupeArray = RemoveDupes(Split(value, separator)) | |
GetItemSize = UBound(DedupeArray) - LBound(DedupeArray) | |
End Function | |
Function RemoveDupStrings(value As String, Optional separator As String = ",") | |
RemoveDupStrings = Join(RemoveDupes(Split(value, separator)), separator) | |
End Function | |
Function RemoveDupes(InputArray) As Variant | |
Dim OutputArray As Variant | |
Dim CurrentValue As Variant | |
Dim A As Variant | |
On Error Resume Next | |
OutputArray = Array("") | |
For Each CurrentValue In InputArray | |
CurrentValue = Trim(CurrentValue) | |
Flag = 0 | |
If IsEmpty(CurrentValue) Then GoTo skip | |
For Each A In OutputArray | |
If A = CurrentValue Then | |
Flag = 1 | |
Exit For | |
End If | |
Next A | |
If Flag = 0 Then | |
ReDim Preserve OutputArray(UBound(OutputArray, 1) + 1) | |
OutputArray(UBound(OutputArray, 1) - 1) = CurrentValue | |
End If | |
skip: | |
Next | |
RemoveDupes = OutputArray | |
End Function | |
Public Function GetString(ByVal cell As Range) As String | |
GetString = cell.value & "" | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment