Reputation: 149
I want to pus comma after every 11 digits in excel my data will be like this.
ODU88131042ODU88131043ODU88131044ODU88131045ODU65110840ODU65110829ODU65110833ODU65110834ODU88131046ODU88131047ODU88131048ODU88131049ODU88131
and i want answer like this
ODU88131046,ODU88131047,ODU88131048,ODU88131049,ODU88131050,ODU88131051,ODU88131052,ODU88131053,ODU88131054,ODU88131055,ODU88131056,ODU88131057,ODU88131058,ODU88131059,ODU88131060,ODU88131061,ODU88131062,ODU88131063,ODU88131064,ODU88131065,ODU88131066,ODU88131067,ODU88131068,ODU88131069,ODU88131070,ODU88131071,ODU88131072,ODU88131073,ODU88131074,ODU88131075,ODU88131076,ODU88131077,ODU88131078,ODU88131079,ODU88131080,ODU88131081,ODU88131082,ODU88131083,ODU88131084,ODU88131085,ODU88131086,ODU88131087,ODU88131088,ODU88131089,ODU88131090,
its a fix that i want comma in very 11 digits and the row it in only one cell and result is also shows in one cell only. please help me out..
Upvotes: 0
Views: 4684
Reputation: 1
=SUBSTITUTE(TRIM(SUBSTITUTE(" "&SUBSTITUTE(TEXT(A1,REPT("00000000000 ",EVEN(LEN(C4)))),"00000000000 ",)," 00000000000 ",))," ",",")
Upvotes: 0
Reputation: 13122
Here's a method using VBA. Select the cell you want to put commas in and run the macro.
Sub AddCommas()
Dim s As String
s = Selection.Value
Dim x As Long
x = Len(s) \ 11
If Len(s) Mod 11 = 0 Then
x = x - 1
End If
Do Until x <= 0
s = Left(s, x * 11) & "," & Mid(s, x * 11 + 1)
x = x - 1
Loop
Selection.Value = s
End Sub
Upvotes: 5