# How to split postal area from post code

#### masplin

##### Active Member
I have UK post codes in the following formats
A1
AA1
A11
AA11

I need to extract just the letters in order to look up the city. In excel I just do this with checking if the 2nd digit is a number using ISNUMBER....simple. I am a newbie to powerpivot, but have tried every trick to get the same function to work without sucess.

The problem is when you use MID on this data it doesn't recognise the 2nd digit as a number and thinks it is text. I tried to use VALUE on the 2nd character, but then throws an error if the character is actually text. I tried to use an IF statement, but doesn't like one value being TEXT and the other being a NUMBER!!!!

Must be an easy solution!!!!

Thanks

Mike

#### ruve1k

##### Board Regular
When a mathematical operation is performed on a numeric text character (e.g. "3") then it will coerce the text into a number (e.g. 3). So by negating the result of MID([Primary Post Code],2,1) one of two things will happen:

1. If the 2nd character is numeric text then it'll convert it into a number so ISERROR will return FALSE.
2. If the 2nd character is NOT numeric text then it'll return an error and ISERROR will return TRUE.
The TRUE or FALSE is then coerced into a number when it is added to 1. So the parameter of the LEFT function will either be 1+FALSE = 1 or 1+TRUE =2.

### Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

#### masplin

##### Active Member
Ah so you are testing if -3 is acceptable whereas -M isn't.

Perfect thanks a lot.

Replies
0
Views
94
Replies
2
Views
66
Replies
11
Views
125
Replies
6
Views
1K
Replies
1
Views
74