+ Reply to Thread
Results 1 to 7 of 7

formula for postcode

  1. #1
    Registered User
    Join Date
    10-30-2006
    Posts
    4

    formula for postcode

    Hi i currently have this formula to take the first 2 letters of a postcode,

    =LEFT(B13,2)

    what i need to do is have a formula that takes the first 2 characters but if the second is a number to ignore it and just put in 1 letter, as some uk postcodes have only i letter then a number, any ideas on this anyone.

    regards
    chris

  2. #2
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264
    Try this for any postcode entered in cell A30

    Please Login or Register  to view this content.
    Ed
    _____________________________
    Always learning, but never enough!
    _____________________________

  3. #3
    Registered User
    Join Date
    10-30-2006
    Posts
    4

    Postcode

    Hi

    Not sure what this code is supposed to do but all i get is a duplicate of the postcode, what i want to do is take either the first letter or first 2 letters of a british postcode.

    regards
    chris

  4. #4
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264
    What it does is to take any postcode entered as a continuous string and format it correctly - not what you wanted - try this instead

    Please Login or Register  to view this content.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    Please Login or Register  to view this content.
    err seems a bit long but it works!

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    or shorter
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-30-2006
    Posts
    4

    Thanks

    Many Thanks for the replies

    =LEFT(A1,1)&IF(ISERROR((--MID(A1,2,1)>0)),MID(A1,2,1),"")

    this is the solution i opted for as it was the most straight forward and worked for my application.

    Regards

    Chris

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1