Need formula to break up column

Sm3tUser

New Member
Joined
Apr 13, 2015
Messages
11
I posted yesterday, but I'm back with another issue. I need my document to look like this:


SuburbStatePostcode
Surry HillsNSW2011
MaroubraVIC3041

<tbody>
</tbody>


At the moment however, it looks like this:


Address
Beverly Hills NSW 2076
Bondi ACT 5607

<tbody>
</tbody>


I can't use Text to Columns because then it would split suburbs that have two words up as well. Eg.


Address
BeverlyHillsNSW6033

<tbody>
</tbody>


So, I need a formula that follows the following conditions:


- If the cell has 4 words/pieces of text, then split the column after the second space
- If the cell has 3 words/pieces of text, then split the column after the first space


It should look like this:


SuburbState/Postcode
AlexandriaNSW 1092
Surry HillsVIC 1039

<tbody>
</tbody>


Afterwards, I will just use Text to Columns to split up the State/Postcode box, so no need to worry about that. The end result should be the first table in my post.


I appreciate any and all help - thanks!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try

Suburb =LEFT(A1,LEN(A1)-9)
State =LEFT(RIGHT(A1,8),3)
Postcode =RIGHT(A1,4)
 
Upvote 0
Too lazy to write a shorter formula.

=LEFT(A2,FIND("~",SUBSTITUTE(A2," ","~",LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2)," ",""))-1))-1)
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,268
Members
449,149
Latest member
mwdbActuary

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