Text to columns not function not worked for a cell

hunghung

New Member
Joined
Feb 27, 2018
Messages
19
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a cell with data combined together with semicolon ";" as cell A1. However, when I use text to columns function with delimited semicolon, it only appear two columns B1 and C1 with results as below.
Please help me this case.
Thanks,


Book1
ABC
112600215;Delivery Date Hemp Blend T-shirt M;2024-11-08 113 Chalk White;S;30;7323451002397;12600215Delivery Date
Sheet1
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
What are you expecting to happen? Text to columns will not split to new rows, but you could use an additional new line delimiter to split the other data to new columns on the same row.
 
Upvote 0
I want result as below from cell B1 to G1. But I tried text to columns but it only have result with two columns as above.

Book1
ABCDEFG
112600215;Delivery Date Hemp Blend T-shirt M;2024-11-08 113 Chalk White;S;30;7323451002397;12600215Delivery DateHemp Blend T-shirt M2024-11-08113 Chalk WhiteS307323451002397
Sheet1
 
Upvote 0
I think you will have to get rid of the line feed characters in the cells before that will work. If you are using 365 you could just use the Textsplit function instead.
 
Upvote 0
I want result as below from cell B1 to G1. But I tried text to columns but it only have result with two columns as above.
Are you sure about that ? If I was doing it I would want to split on both the semi-column AND the line break character.
As Rory mentioned if you are using 365 it would look like this:

Book4
ABCDEFGHIJ
112600215;Delivery Date Hemp Blend T-shirt M;2024-11-08 113 Chalk White;S;30;7323451002397;12600215Delivery DateHemp Blend T-shirt M2024-11-08113 Chalk WhiteS307323451002397
Sheet1 (2)
Cell Formulas
RangeFormula
B1:J1B1=TEXTSPLIT(A1,{";"," "})
Dynamic array formulas.


To achieve the same using Text to Columns requires quite a few steps.
• Select column A
• ctrl+H (replace)
○ In find what put ctrl+J
○ In replace with put ; ie semi-column
○ Replace All
• Data / Text to columns
○ With column A still selected
○ Delimited > Other ; (semi-colon)
○ Next
○ In the next screen select the date column Select date and the format ymd
Now you can either select the last number column and Select Text or format as a number after you complete the process depending on whether its meant to be a number or more like a serial number.
○ Finish
If you didn't make the last column Text it will mostly likely show as scientific notation so just format it as a number with no decimal places.
 
Upvote 0
Many thanks for Fluff, Rory and Alex for clarifying me. The solution is I should remove linefeed from cell A1 before doing text to columns or select semicolon as one delimiter & then select other & type Ctrl J in the box next to it on text to columns function.
 
Upvote 0
I have one more question. I have cell A1 and A2 as below with data separated by multiple spaces. Is there any way to use Text to columns to have data from cells B1 to G1 and B2 to G2
Thank you in advance.

Book2
ABCDEFG
114300012 Abisko Sun-hoodie Dress W 537 Ultramarine XXS 10 732345108644114300012Abisko Sun-hoodie Dress W537 UltramarineXXS107323451086441
212600265 Hemp Blend Out Here T-shirt M 160 Ochre S 4 732345108425612600265Hemp Blend Out Here T-shirt M160 OchreS47323451084256
Sheet1
 
Last edited:
Upvote 0
Here's a vba solution, if you like.
Code:
Sub test()
    Dim a, i&, ii&, s$, x
    With Range("a1", Range("a" & Rows.Count).End(xlUp))
        a = .Resize(, 2).Value
        With CreateObject("VBScript.RegExp")
            .Global = True
            .Pattern = "(;|\n+| {2,})"
            For i = 1 To UBound(a, 1)
                s = a(i, 1)
                If s <> "" Then
                    x = Application.Trim(Split(.Replace(a(i, 1), Chr(2)), Chr(2)))
                    If UBound(x) > UBound(a, 2) Then
                        ReDim Preserve a(1 To UBound(a, 1), 1 To UBound(x))
                    End If
                    For ii = 1 To UBound(x)
                        a(i, ii) = x(ii)
                    Next
                End If
            Next
        End With
        .Columns(2).Resize(, UBound(a, 2)) = a
    End With
End Sub

Book1
ABCDEFGHI
112600215;Delivery Date Hemp Blend T-shirt M;2024-11-08 113 Chalk White;S;30;7323451002397;12600215Delivery DateHemp Blend T-shirt M2024/11/8113 Chalk WhiteS307323451002397
214300012 Abisko Sun-hoodie Dress W 537 Ultramarine XXS 10 732345108644114300012Abisko Sun-hoodie Dress W537 UltramarineXXS107323451086441
Sheet1
 
Upvote 0
Here's a vba solution, if you like.
Code:
Sub test()
    Dim a, i&, ii&, s$, x
    With Range("a1", Range("a" & Rows.Count).End(xlUp))
        a = .Resize(, 2).Value
        With CreateObject("VBScript.RegExp")
            .Global = True
            .Pattern = "(;|\n+| {2,})"
            For i = 1 To UBound(a, 1)
                s = a(i, 1)
                If s <> "" Then
                    x = Application.Trim(Split(.Replace(a(i, 1), Chr(2)), Chr(2)))
                    If UBound(x) > UBound(a, 2) Then
                        ReDim Preserve a(1 To UBound(a, 1), 1 To UBound(x))
                    End If
                    For ii = 1 To UBound(x)
                        a(i, ii) = x(ii)
                    Next
                End If
            Next
        End With
        .Columns(2).Resize(, UBound(a, 2)) = a
    End With
End Sub

Book1
ABCDEFGHI
112600215;Delivery Date Hemp Blend T-shirt M;2024-11-08 113 Chalk White;S;30;7323451002397;12600215Delivery DateHemp Blend T-shirt M2024/11/8113 Chalk WhiteS307323451002397
214300012 Abisko Sun-hoodie Dress W 537 Ultramarine XXS 10 732345108644114300012Abisko Sun-hoodie Dress W537 UltramarineXXS107323451086441
Sheet1

I'm not familiar with RegExp, do you have another solution for case with multiple space below.
Thanks,
Book3
A
114300012 Abisko Sun-hoodie Dress W 537 Ultramarine XXS 10 7323451086441
Sheet1
 
Upvote 0

Forum statistics

Threads
1,223,929
Messages
6,175,461
Members
452,645
Latest member
Tante

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top