I need a formula that will extract the part of a post code I want. I would
like to extract the first letter or letters from a postcode to use in a
VLOOKUP. My problem is that there can be one letter or two letters at the
start of the postcode.
So if the postcode is B1 1AZ the formula result would be B and if the
formula is BA1 1AZ the result would be BA.
Thanks
with a postcode in A1, this formula gets to the first part of the code
=LEFT(A1,SEARCH(" ",A1)-1)
however, it doesn't resolve it - SO would suggest using a user defined
function as follows
Function pcodereturn(Postcode As String)
While Left(Postcode, 1) <> " " And (Asc(Left(Postcode, 1)) < 48 Or
Asc(Left(Postcode, 1)) > 57)
pcodereturn = pcodereturn & Left(Postcode, 1)
Postcode = Right(Postcode, Len(Postcode) - 1)
Wend
End Function
SPL
<aidan.h...@virgin.net> wrote in message
news:1146755508.7...@u72g2000cwu.googlegroups.com...
Assuming the postcode is in D12, in E12 I have
=IF(ISERROR((VALUE(MID(D12,2,1)))),"10",(VALUE(MID(D12,2,1))))
and in F12 I have
=IF(E12<=9,LEFT(D12,1),LEFT(D12,2))
I'm having trouble putting these two together in the same cell but I think
that might have something to do with it being IF(IF. If anyone could help I
would be very grateful!
"PH NEWS" <steven.l...@phresearch.com> wrote in message
news:445a0e84$0$8343$da0f...@news.zen.co.uk...
=IF(VALUE(IF(ISERROR((VALUE(MID(D12,2,1)))),"10",(VALUE(MID(D12,2,1)))))=10,
LEFT(D12,2),LEFT(D12,1))
"PH NEWS" <steven.l...@phresearch.com> wrote in message
news:445a0e84$0$8343$da0f...@news.zen.co.uk...