One column converted to two - - HOW?

RodneyW

Active Member
Joined
Sep 24, 2010
Messages
470
Office Version
  1. 2013
Platform
  1. Windows
If someone sends me a database, with one cell with an entry such as "1234 Smith St, Apt 5"

Can it be converted to two cells, one with "1234 Smith Way" and another with "Apt 5"

Thanks in advance
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi
If text in A1

Code:
B1=LEFT(A1,FIND(",",A1)-1)
c1=RIGHT(A1,LEN(A1)-FIND(",",A1)-1)
 
Upvote 0
If you have an entire column like that you can use Text To Columns on the data tab & select Delimited > Next > Comma > Finish
 
Upvote 0
And if you like with code try for one cell
can easily amended for column
Code:
Sub spliteit()
x = Split(Range("a1"), ",")
Range("b1") = x(0)
Range("c1") = x(1)
End Sub

For data in column A


Code:
Sub spliteitC()
a = Application.Transpose(Range("a1:a" & Cells(Rows.Count, 1).End(xlUp).Row))
For i = 1 To UBound(a)
x = Split(Range("a1"), ",")
Range("b" & i) = x(0)
Range("c" & i) = x(1)
Next
End Sub
 
Last edited:
Upvote 0
So sorry correction for the second code
Code:
Sub spliteitC()
a = Application.Transpose(Range("a1:a" & Cells(Rows.Count, 1).End(xlUp).Row))
For i = 1 To UBound(a)
x = Split(a(i)), ",")
Range("b" & i) = x(0)
Range("c" & i) = x(1)
Next
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

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