Postcode Prefix formula

waxb18

Board Regular
Joined
May 31, 2011
Messages
179
I have a series of post codes and need to extract the first letter(s) and first number(s),

EG:

AL1 3NF = AL1

S1 4NF = S1

GU12 9NF = GU12

Ive tried =left([cell],4), but this then includes the space in the AL1 code and in case of the S1 postal code include the 4,
so basically im asking if someone would help me by providing a formula???
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Let's face it Peter, I'm just too slow!!
 
Upvote 0
i am using that formula already, however not all postcode prefixes are 3 characters long,

for example

S1 4NF = should return S , however this forumla is returning S1

I need the formula to return only prefix letters, not numbers.

hope this makes sense.
 
Upvote 0
=IFERROR(IF(MID(B2,2,1)*1>0,LEFT(B2,1),LEFT(B2,2)),LEFT(B2,2))

Where B2 contains the postcode
 
Upvote 0
=IFERROR(IF(MID(B2,2,1)*1>0,LEFT(B2,1),LEFT(B2,2)),LEFT(B2,2))

Where B2 contains the postcode

Hi - thanks for the quick replies

It is returning, invalid name error

=IFERROR(IF(MID(J2,2,1)*1>0,LEFT(J2,1),LEFT(J2,2)),LEFT(J2,2))

postcode on my sheet is in cell J2
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,723
Members
452,939
Latest member
WCrawford

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