+ Reply to Thread
Results 1 to 5 of 5

Uk Post Code Ignoring certain parts formula

  1. #1
    Daywalker
    Guest

    Uk Post Code Ignoring certain parts formula

    Evening Folks,

    Working on a database, and trying to get a formula to work on looking at a full post code and listing in another cell the shortened version.

    i.e : EH54 5DZ, and showing in other cell just EH

    I can do this with formula =LEFT,SEARCH("".L2,2))

    But my problem is when I get a post code such as "G21 1DA" or "G1 1DA", where I only want it to show the G on its own, it's the only post code that has one letter in it, and want to ignore the rest.

    Can I do this with a generic formula that would cover both my examples above i.e EH54 5DZ = EH & G1 1DA = G?

    Cheers,

    D.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    =IF(OR(FIND(" ",A1)=4,FIND(" ",A1)=3),LEFT(A1,1),LEFT(A1,2))
    or

    =IF(ISNUMBER(MID(A1,2,1)+0),LEFT(A1,1),LEFT(A1,2))
    VBA Noob
    Last edited by VBA Noob; 03-07-2008 at 04:53 PM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Daywalker
    Guest

    Nope

    Just tried, seemed to work with some, but some of the other posts codes are only showig as one letter rather than 2. But perfect with the only postcode with one letter (G)

    Where before a postcode IV6 7UA is now only showing as I. As I'll be looking at all postcodes in Scotland.

    But thanks for your quick reply, any other idea's

  4. #4
    Daywalker
    Guest

    Apologies

    VBA, sorry, never noticed the second formula you entered, that works a treat. Too busy trying the first to notice.

    Thanks for your help.

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    My fault.

    Added after I posted the first.

    Good luck

    VBA Noob

+ 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