Function iCom(r As Range)
Dim str As String
Dim x As Integer
str = r
Dim b As Boolean
b = True
For x = 1 To Len(str)
If b = True Then
If x Mod 4 = 0 And Mid(str, x, 1) <> "," Then
str = Left(str, x) & "," & Right(str, Len(str) - x)
b = False
End If
Else
If x Mod 5 = 0 And Mid(str, x, 1) <> "," Then
str = Left(str, x) & "," & Right(str, Len(str) - x)
End If
End If
Next x
iCom = str
End Function
=LEFT(MID(A2,1,4)&","&MID(A2,5,4)&","&MID(A2,9,4)&","&MID(A2,13,4)&","&MID(A2,17,4)&",",FIND(",",MID(A2,1,4)&","&MID(A2,5,4)&","&MID(A2,9,4)&","&MID(A2,13,4)&","&MID(A2,17,4)&",",LEN(A2))-1)
Function SplitString(rng As Range, SplitLength As Long, Optional Delimiter As String = ",") As String
Dim n As Long
If rng = "" Then Exit Function
For n = 0 To Len(rng) Step SplitLength
If SplitString = "" Then
SplitString = Mid(rng, n + 1, SplitLength)
Else
SplitString = SplitString & Delimiter & Mid(rng, n + 1, SplitLength)
End If
Next
SplitString = Left(SplitString, Len(SplitString) - Len(Delimiter))
End Function
=SplitString(A2,4)
=SplitString(A2,4,"-")