How to split postcodes into new cells

MsCynic

Board Regular
Joined
May 21, 2006
Messages
122
I receive regular spreadsheets that I use for mailouts which need to be sorted by postcode.

Unfortunately, the postcodes are usually found in the same cells as other address data, making it impossible to use the codes for sorting:

https://imgur.com/a/FgOQ5

I can't use the split to cell function as there are spaces between street names and suburb names which would move the wrong text into new columns.

Is there a way to isolate all postcodes from columns F, G and H?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi,

If the Post codes are Always at the End of the text string And are Always 4 digits:


Book1
FGHI
2Papamoa 31183118
3
4###### Parton Road
Sheet6
Cell Formulas
RangeFormula
I2=IF(ISNUMBER(RIGHT(F2,4)+0),RIGHT(F2,4)+0,"")
 
Upvote 0
Hello again,

What is the method to remove the postcodes from column F once I have put them in their own column?

Thanks in advance for your advice.
 
Upvote 0
Hi,

If you want it removed from Column F itself, you'll need VBA, and that will also render Column I formula above useless since it needs to refer to Column F, so you'll end up needing VBA for both requirements.

However, you can use a formula in say Column H and just "Hide" Column F if you like:


Book1
FGHI
2Papamoa 3118Papamoa3118
3
4###### Parton Road###### Parton Road
Sheet134
Cell Formulas
RangeFormula
H2=TRIM(LEFT(F2,IF(ISNUMBER(RIGHT(F2,4)+0),LEN(F2)-4,255)))
I2=IF(ISNUMBER(RIGHT(F2,4)+0),RIGHT(F2,4),"")
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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