+ Reply to Thread
Results 1 to 5 of 5

British Postcodes - Inserting a Space

Hybrid View

  1. #1
    Registered User
    Join Date
    05-25-2010
    Location
    Manchester, United Kingdom
    MS-Off Ver
    Excel 2003 SP3
    Posts
    4

    British Postcodes - Inserting a Space

    Hello,

    I have a range of values which are extracted from our system, in this case postcodes.

    British postcodes have to follow a certain format. There can be one of 5 permutations:

    M1 1AA
    M27 4LA
    BL1 1AA
    DN26 2WX
    SW1A 1AA

    As you can see, what we call the "postcode unit" (the last three characters) has to be separate from the postcode area and sector (the M1/M27/BL1/DN26/SW1A).

    Unfortunately, our system extracts correctly inputted data (M1 1AA for example) with the everything erroneously joined together (so it pulls M11AA/M274LA and so on instead). Our system cannot be amended to extract the information correctly.

    I need Excel to put a space in the right place on my "formatted data sheet" when I paste the data in on on "raw data" sheet.

    I have tried =RIGHT, =LEFT and =MID, but due to the different lengths of postcodes (smallest is a 2/3, biggest is a 4/3 as per above) this hasn't really worked for me.

    Alternatively, if there is a way for Excel to cut off the last three digits of a postcode, I can then use =CONCATENATE to rejoin them together with a space.



    I hope this makes sense and someone can give me a few pointers! If you need any more info let me know...

    Ta,

    Ben

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: British Poscodes/Inserting a Space

    Hi,

    This should correct your postcode

    =LEFT(A1,LEN(A1)-3)&" "&RIGHT(A1,3)
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: British Postcodes - Inserting a Space

    bendoyle1983,

    Can we see examples of the raw data, and what the correct result should be.

    Pleaase post your workbook, or a sample without sensative information.

    Click on the New Post button, then scroll down and see Manage Attachments.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,703

    Re: British Postcodes - Inserting a Space

    You could use this formula

    =REPLACE(A1,LEN(A1)-2,0," ")
    Audere est facere

  5. #5
    Registered User
    Join Date
    05-25-2010
    Location
    Manchester, United Kingdom
    MS-Off Ver
    Excel 2003 SP3
    Posts
    4

    Re: British Postcodes - Inserting a Space

    AMAZING, thanks so much guys, you've got me out of a rut!

    I'm learning so much. The formulas here make sense when I'm shown!

    THANKS!

+ 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