PostCode Extraction data

Bravo2003

Active Member
Joined
Apr 1, 2010
Messages
278
Office Version
  1. 365
Platform
  1. Windows
Hi All,
This should be a simple one?

I'm currently using - =IF(D3="EXC","",LEFT(D3,2))

Column D being a list of postcodes.
works fine for most Postcodes, but the single letter ones - i.e Sheffield/S and Birmingham/B it add the number to it, obviously as i'm asking for the 2 characters in the formula.

Is there a way to make it not include numbers and just return either the 2 letter or 1 letter Postcode required?

Thanks

PS: - I actually reduced the formula to just - =LEFT(D3,2) as I don't need the IF part anymore.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hey try this:

Code:
IF(ISNUMBER(SEARCH(MID(D3,2,1),"0123456789")),LEFT(D3,1),LEFT(D3,2))

Or slightly shorter:

Code:
IF(ISNUMBER(VALUE(MID(D3,2,1))),LEFT(D3,1),LEFT(D3,2))
 
Last edited:
Upvote 0
Hey try this:

Code:
IF(ISNUMBER(SEARCH(MID(D3,2,1),"0123456789")),LEFT(D3,1),LEFT(D3,2))

Or slightly shorter:

Code:
IF(ISNUMBER(VALUE(MID(D3,2,1))),LEFT(D3,1),LEFT(D3,2))


Excellent, Thanks
Knew it would be a simple one.
 
Upvote 0
Or this:

Code:
=IF(ISNUMBER(--MID(D3,2,1)),LEFT(D3,1),LEFT(D3,2))
 
Upvote 0

Forum statistics

Threads
1,214,657
Messages
6,120,769
Members
448,991
Latest member
Hanakoro

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