SOLVED

Text to columns

%3CLINGO-SUB%20id%3D%22lingo-sub-1530694%22%20slang%3D%22en-US%22%3EText%20to%20columns%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1530694%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3EI%20am%20facing%20a%20problem%20in%20text%20to%20column%20transformation%20with%20the%20following%20data%20(I%20have%2010k%20rows%20of%20similar%20pattern)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%22Sky%3A%20Children%20of%20the%20Light%3C%2FSTRONG%3Ethatgamecompany%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20the%20data%20in%20which%20the%20first%20part%20is%20in%20%22Blue%20Color%22%20and%20the%20second%20part%20which%20is%20in%20black.%20I%20want%20to%20separate%20both%20of%20them.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20leads%20are%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20and%20Best%2C%3C%2FP%3E%3CP%3ESaikat.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1530694%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1530739%22%20slang%3D%22en-US%22%3ERe%3A%20Text%20to%20columns%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1530739%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F504026%22%20target%3D%22_blank%22%3E%40Saikat755%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20may%20create%20a%20User%20Defined%20Function%20to%20Split%20the%20Text%20based%20on%20font%20color.%3C%2FP%3E%3CP%3EPlace%20the%20following%20code%20on%20a%20Standard%20Module%20like%20Module1%20and%20then%20you%20can%20use%20this%20UDF%20on%20Worksheet%20just%20like%20a%20Regular%20Excel%20Function.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EFunction%20SplitText(Rng%20As%20Range)%20As%20String%0ADim%20i%20%20%20%20%20%20%20As%20Long%0ADim%20strOut%20%20As%20String%0ADim%20str%20%20%20%20%20As%20String%0Astr%20%3D%20Rng.Value%0AFor%20i%20%3D%201%20To%20Len(str)%0A%20%20%20%20If%20Rng.Characters(i%2C%201).Font.Color%20%3D%20RGB(0%2C%20112%2C%20192)%20Then%0A%20%20%20%20%20%20%20%20strOut%20%3D%20strOut%20%26amp%3B%20Mid(str%2C%20i%2C%201)%0A%20%20%20%20End%20If%0ANext%20i%0ASplitText%20%3D%20strOut%0AEnd%20Function%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAssuming%20your%20string%20is%20in%20cell%20A1%2C%20then%20try%20this...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20B1%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DSplitText(A1)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20C1%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DSUBSTITUTE(A1%2CB1%2C%22%22)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Split%20Text.jpg%22%20style%3D%22width%3A%20989px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F206215iC206EBB765B9FCB1%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Split%20Text.jpg%22%20alt%3D%22Split%20Text.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1531167%22%20slang%3D%22en-US%22%3ERe%3A%20Text%20to%20columns%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1531167%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F394231%22%20target%3D%22_blank%22%3E%40Subodh_Tiwari_sktneer%3C%2FA%3E%26nbsp%3BThis%20helps%20me%20solve%20my%20purpose.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%20and%20Best%2C%3C%2FP%3E%3CP%3ESaikat.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1531189%22%20slang%3D%22en-US%22%3ERe%3A%20Text%20to%20columns%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1531189%22%20slang%3D%22en-US%22%3E%3CP%3EYou're%20welcome%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F504026%22%20target%3D%22_blank%22%3E%40Saikat755%3C%2FA%3E!%20Glad%20it%20worked%20as%20desired.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi All,

I am facing a problem in text to column transformation with the following data (I have 10k rows of similar pattern)

 

"Sky: Children of the Lightthatgamecompany"

 

I have the data in which the first part is in "Blue Color" and the second part which is in black. I want to separate both of them.

 

Any leads are appreciated.

 

Thanks and Best,

Saikat.

3 Replies
Best Response confirmed by Saikat755 (New Contributor)
Solution

@Saikat755 

You may create a User Defined Function to Split the Text based on font color.

Place the following code on a Standard Module like Module1 and then you can use this UDF on Worksheet just like a Regular Excel Function.

 

Function SplitText(Rng As Range) As String
Dim i       As Long
Dim strOut  As String
Dim str     As String
str = Rng.Value
For i = 1 To Len(str)
    If Rng.Characters(i, 1).Font.Color = RGB(0, 112, 192) Then
        strOut = strOut & Mid(str, i, 1)
    End If
Next i
SplitText = strOut
End Function

 

Assuming your string is in cell A1, then try this...

 

In B1

=SplitText(A1)

 

In C1

=SUBSTITUTE(A1,B1,"")

 

Split Text.jpg

 

Thanks @Subodh_Tiwari_sktneer This helps me solve my purpose.

 

Regards and Best,

Saikat.

You're welcome @Saikat755! Glad it worked as desired.