-
-
Save doggy8088/96aee1271688ac5f6894a3f70b0b68b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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