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???
 
The Find function with the array finds the first location of each digit 0-9. The Min then determines the first of these locations.
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Sorry for resurrecting a 7 year old post....

Im working with postcodes, some of which have spaces, some which do not so its a right mess!

Ive used the answer from the thread to create the following, but I cant help feeling that it is a bit long and overcomplicated (I know there are many ways to skin a cat and Im happy that I get the correct results, but was just wondering if I could streamline it a little!)

=IF(RIGHT(LEFT([@Postcode],MIN(FIND({1,2,3,4,5,6,7,8,9,0},[@Postcode]&"0123456789"))+1),1)=" ",LEFT([@Postcode],MIN(FIND({1,2,3,4,5,6,7,8,9,0},[@Postcode]&"0123456789"))),LEFT([@Postcode],MIN(FIND({1,2,3,4,5,6,7,8,9,0},[@Postcode]&"0123456789"))+1))
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,730
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