+ Reply to Thread
Results 1 to 9 of 9

Postcode grouping

  1. #1
    Registered User
    Join Date
    06-12-2019
    Location
    Brighton
    MS-Off Ver
    2013
    Posts
    3

    Postcode grouping

    Hello all,

    I have a data set which lists 6 digit postcodes & a number of houses in each of them.

    I would like to combine these postcodes into their respective 3 digit area to get a cumulative amount of houses in each.

    E.G
    A1 ------------------------------A2
    BR1 11NF-----------------------1
    BR1 1AA-------------------------1
    BR1 1AB------------------------ 2

    I would want to show
    A1 ------------------------------A2
    BR1------------------------------4

    Is this possible and could anyone kindly help me?

    many thanks
    Last edited by jmay91; 06-12-2019 at 12:40 PM.

  2. #2
    Registered User
    Join Date
    01-24-2019
    Location
    Lancaster County, PA USA
    MS-Off Ver
    2016
    Posts
    8

    Re: Postcode grouping

    You could use a Pivot table either creating a calculated field for Left(postalcode,3) or creating a new column to do the same thing, then sum the house quantity.

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,104

    Re: Postcode grouping

    Another option, assuming your data is in columns A & B
    Please Login or Register  to view this content.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,933

    Re: Postcode grouping

    A Power Query Solution. Here is the Mcode. Attached is a demo file
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    06-12-2019
    Location
    Brighton
    MS-Off Ver
    2013
    Posts
    3

    Re: Postcode grouping

    Quote Originally Posted by Fluff13 View Post
    Another option, assuming your data is in columns A & B
    Please Login or Register  to view this content.
    Thank you for all your help folks, very kind of you. I went with this option as I took it as a learning opportunity to expand my Macro knowledge.
    Very helpful,
    have a good day!
    J

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,104

    Re: Postcode grouping

    You're welcome & thanks for the feedback

  7. #7
    Registered User
    Join Date
    06-12-2019
    Location
    Brighton
    MS-Off Ver
    2013
    Posts
    3

    Re: Postcode grouping

    Hello all,
    Back again with a Q on the macro. I am attempting to get the postcodes to show 2, 3 & 4 digits now e.g
    E1
    SW2
    SW12

    I noticed before that 2 & 3 digits showed, so i changed the formula below (bolded what I changed) and it runs fine but then nothing happens. Would anyone know why?
    Please Login or Register  to view this content.
    Last edited by alansidman; 06-25-2019 at 07:09 AM.

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,933

    Re: Postcode grouping

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,104

    Re: Postcode grouping

    That modification works fine for me.
    If you are just trying to get the first set of characters, how about
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Postcode check and return of value in column title and cell adjacent to postcode
    By BigTP in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-26-2018, 05:04 AM
  2. Replies: 0
    Last Post: 12-10-2015, 08:24 AM
  3. Replies: 4
    Last Post: 07-26-2014, 02:35 AM
  4. Postcode to postcode distance checker
    By KerryLL1221 in forum Excel General
    Replies: 1
    Last Post: 02-21-2014, 09:42 AM
  5. Lookup postcode zone from postcode
    By Elmholt in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-08-2013, 09:26 AM
  6. [SOLVED] Help needed trimming full postcode address to postcode sector.
    By Mikey7346 in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 08-10-2012, 05:11 PM

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