How to split text into Columns, Data is with no space in between words and numbers

satish78

Board Regular
Joined
Aug 31, 2014
Messages
218
Hi Friends,

I been trying to split text into columns but did not find a suitable post over here.

Here is the sample file with data extracted into columns
Manually, its taking long human hours to complete.

https://spaces.hightail.com/space/OU0YRqc7Yl

I do not know if it is possible with formula or macro which does exact output.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Anyone help me on this?
You will get many more potential helpers, and faster help, if you explain your problem clearly in words and, if needed, post a small (copyable) screen shot or two directly in your post. My signature block below has help regarding that.

You could try this macro in a copy of your workbook.

A few comments though

1. I assume that your cell C14 is a mistake and it should have been New York, NY

2. I assume that your cell C16 is a mistake and it should be Feasterville-Trevose, PA

3. You would need to provide some logic for excluding the first part of the text in row 19. In all the other rows the 'Industry' goes from the start of the text up to where a lower case letter is followed immediately by an upper case letter. The upshot is that my code returns Accountants To You. Staffing and Recruiting in that row.

Code:
Sub Split_Data()
  Dim RX As Object
  Dim a As Variant, b As Variant
  Dim i As Long
  
  Const P1 As String = "^.+?[a-z](?=[A-Z]|\d)"
  Const P2 As String = "[a-z][A-Z].+?(?=[\d, ]*followers)"
  Const P3 As String = "[\d,]+(?= employee)"
  
  Set RX = CreateObject("VBScript.RegExp")
  a = Range("A2", Range("A" & Rows.Count).End(xlUp)).Value
  ReDim b(1 To UBound(a), 1 To 3)
  For i = 1 To UBound(a)
    RX.Pattern = P1
    If RX.Test(a(i, 1)) Then b(i, 1) = RX.Execute(a(i, 1))(0)
    RX.Pattern = P2
    If RX.Test(a(i, 1)) Then b(i, 2) = Mid(RX.Execute(a(i, 1))(0), 2)
    RX.Pattern = P3
    If RX.Test(a(i, 1)) Then b(i, 3) = RX.Execute(a(i, 1))(0)
  Next i
  Range("B2:D2").Resize(UBound(b)).Value = b
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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