+ Reply to Thread
Results 1 to 27 of 27

Address Cleaning.....

  1. #1
    Registered User
    Join Date
    02-09-2023
    Location
    London, England
    MS-Off Ver
    O365
    Posts
    10

    Address Cleaning.....

    Hi,

    We get sent a lot of addresses by clients and despite our requests for how we need the data submitted there are always errors in it. - stray characters, empty fields, extra spaces, no spaces etc.

    I'm looking for a formula (or formulas!) to help clean address in a list of addresses. I've attached some sample data of a sheet showing the typical errors we might get. Can anyone help? - What's the best way to then clean the data each time we get sent a spreadsheet of addresses?

    Summary of how we need the data in order to be able to upload it (for couriers etc)

    1) Recipient name must be 1 column, and can?t be split into two columns for first name and surname.
    2) Recipient name, Address Line 1, City and Postcode must always be populated.
    3) Address Line 2 is an optional field and it doesn?t matter if this is empty. Referencing the address below I have shown as an example? if someone had written ?4 Allan Close, Enfield? into Address Line 1 column, we would separate it out so it moves ?Enfield? into Address Line 2 field. Also, if someone had written ?Enfield, London? into the City field and Address Line 2 was empty, we would move ?Enfield? back into the Address Line 2 field.
    4) There can't be any commas or special characters
    5) Postcodes must have a break (one space) in the letters and can?t be one unbroken line. For example if someone wrote EC1V4RX we would create it to be EC1V 4RX

    Thanks in advance,
    Mark
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,673

    Re: Address Cleaning.....

    You will (almost certainly!) need VBA to clean your data but getting a perfect set of addresses is unlikely

    In your sample file please add the required results.

    Many of [Address Line 2] (to me) would appear mandatory and determining whether an entry in this column (for example) is a "City" will be difficult.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Registered User
    Join Date
    02-09-2023
    Location
    London, England
    MS-Off Ver
    O365
    Posts
    10

    Re: Address Cleaning.....

    Thanks for the reply. I've updated the sample spreadsheet with required results. - I've actually tweaked the sample data as well as I realised I hadn't given an example with the postcode without spaces.

    Yea, understand that perfect set of addresses may not be possible, but as close to that as possible would save a lot of time.

    Thanks,
    Mark
    Attached Files Attached Files

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Address Cleaning.....

    is that what you want?
    (tailored to your example)
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-09-2023
    Location
    London, England
    MS-Off Ver
    O365
    Posts
    10

    Re: Address Cleaning.....

    Yes, sandy666 that looks great thanks. How do I run that on other sheets?

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Address Cleaning.....

    Quote Originally Posted by bongomark View Post
    How do I run that on other sheets?
    more details please

  7. #7
    Registered User
    Join Date
    02-09-2023
    Location
    London, England
    MS-Off Ver
    O365
    Posts
    10

    Re: Address Cleaning.....

    So I get sent lots of spreadsheets of addresses and need to run the process that you've done each time I receive one. Is it possible to have a sheet setup that I can drop the data into each time, which then formats it correctly in a new sheet?

  8. #8
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Address Cleaning.....

    sorry but no
    solution was tailored to your example with individual approach
    you can do that if you create your own M (Power Query) to each new data
    in your example there are no rules and it's hard to create a universal solution

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,673

    Re: Address Cleaning.....

    Please Login or Register  to view this content.
    Ouput in blue highlighted area

    Copy data into A:F (as per this file) and click RUN: output will be column G onwards.

    I am sure there will be other "anomalies".
    Attached Files Attached Files
    Last edited by JohnTopley; 02-09-2023 at 03:11 PM.

  10. #10
    Registered User
    Join Date
    02-09-2023
    Location
    London, England
    MS-Off Ver
    O365
    Posts
    10

    Re: Address Cleaning.....

    That's amazing, thanks John.

    You're right about anomalies - I've just found a couple!....
    1) If address line 1 is empty but address line 2 is populated is it possible to move the data to address line 1?
    2) If a postcode is missing we just get an error. If it possible for it to report which cell or line the postcode is missing from?
    3) A colleague has just given me two other examples of how we sometimes get data supplied. Is it possible to incorporate these on the same sheet, or would they need a separate one?

    I've attached another sheet with examples of each of the above.

    Thanks again so much,
    Mark
    Attached Files Attached Files

  11. #11
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Address Cleaning.....

    could you post excel file with one hundred rows of data not only a few?
    both kinds (will be 200 rows)
    Last edited by sandy666; 02-10-2023 at 06:32 AM.

  12. #12
    Registered User
    Join Date
    02-09-2023
    Location
    London, England
    MS-Off Ver
    O365
    Posts
    10

    Re: Address Cleaning.....

    Hey Sandy666, attached two new files now. Again would need to be able to clean up new spreadsheets on a regular basis, not just the attached ones.
    Attached Files Attached Files

  13. #13
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Address Cleaning.....

    Thanks, I'll look at it a bit later and try to find some algorithm

  14. #14
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Address Cleaning.....

    i think it would be useful to list the cities and towns of all your country or those that were, are or will be used in these files
    I understand that the district should not be treated like a city

  15. #15
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Address Cleaning.....

    where do you get such a mishmash?

    check this one, based on postcodes
    Attached Files Attached Files
    Last edited by sandy666; 02-11-2023 at 04:51 PM. Reason: ganz neue idee

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,673

    Re: Address Cleaning.....

    a "quick" sample extract: Added CITIES (thanks to Sandy) but needs further work!

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JohnTopley; 02-10-2023 at 05:21 PM.

  17. #17
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Address Cleaning.....

    @John
    download file from post#15 and unhide tab, there will be list of 2864 cities/towns and counties

  18. #18
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,673

    Re: Address Cleaning.....

    @Sandy: thank you - updated my post (#16) to include city search.

  19. #19
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Address Cleaning.....

    @John
    My pleasure

  20. #20
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Address Cleaning.....

    you quit from this thread 3 days ago so ...



    if the problem is solved, make us happy and hit Add Reputation (bottom left corner next to the post that was helpful)
    and then mark the thread as SOLVED (top above your first post - Thread Tools)

  21. #21
    Registered User
    Join Date
    02-09-2023
    Location
    London, England
    MS-Off Ver
    O365
    Posts
    10

    Re: Address Cleaning.....

    Quote Originally Posted by sandy666 View Post
    you quit from this thread 3 days ago so ...



    if the problem is solved, make us happy and hit Add Reputation (bottom left corner next to the post that was helpful)
    and then mark the thread as SOLVED (top above your first post - Thread Tools)
    Hi Sandy666,

    Apologies, I've been away for a few days. Thanks for helping and sorting that data out, that is really helpful. However I need to be able to process new data regularly. Is there a way to have this in a form like the sheet JohnTopley did so that I can drop new data in each time?

    Many

  22. #22
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Address Cleaning.....

    did you try paste new data into the source table then refresh green table? (on sheet one)
    I can't test it because I have no new data

    due to the variety of unexpected entries (column D), operator (your) intervention will sometimes be required

    but if John's solution works you don't need others
    Last edited by sandy666; 02-13-2023 at 01:32 PM. Reason: typo

  23. #23
    Registered User
    Join Date
    02-09-2023
    Location
    London, England
    MS-Off Ver
    O365
    Posts
    10

    Re: Address Cleaning.....

    Quote Originally Posted by bongomark View Post
    That's amazing, thanks John.

    You're right about anomalies - I've just found a couple!....
    1) If address line 1 is empty but address line 2 is populated is it possible to move the data to address line 1?
    2) If a postcode is missing we just get an error. If it possible for it to report which cell or line the postcode is missing from?
    3) A colleague has just given me two other examples of how we sometimes get data supplied. Is it possible to incorporate these on the same sheet, or would they need a separate one?

    I've attached another sheet with examples of each of the above.

    Thanks again so much,
    Mark
    Hi JohnTopley,

    Is it by any chance possible to amend the sheet you produced with points 1) and 2) added to it?

    Thanks,
    Mark

  24. #24
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,673

    Re: Address Cleaning.....

    The attached identifies Missing Post Codes (row 97) BUT the data you supplied is not in thhe same format as your original so there is no "Address Line 1" or "Address line 2" differentiation.

    And addresses with no delimiter (",") are almost impossible to split (as per attached) into components (Address Line 1/Address Line 2) other than Post Code and Cities (thanks to Sandy's list).
    Attached Files Attached Files

  25. #25
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Address Cleaning.....

    [removed by s666]

  26. #26
    Registered User
    Join Date
    02-09-2023
    Location
    London, England
    MS-Off Ver
    O365
    Posts
    10

    Re: Address Cleaning.....

    Quote Originally Posted by JohnTopley View Post
    The attached identifies Missing Post Codes (row 97) BUT the data you supplied is not in thhe same format as your original so there is no "Address Line 1" or "Address line 2" differentiation.

    And addresses with no delimiter (",") are almost impossible to split (as per attached) into components (Address Line 1/Address Line 2) other than Post Code and Cities (thanks to Sandy's list).
    Hi John,

    I think if we could base it on the initial spreadsheet that I sent over that you, as that is the most common way in which I receive the addresses, that would be great. Would it be possible to add the two points below to that, or will it not work?
    1) If address line 1 is empty but address line 2 is populated is it possible to move the data to address line 1?
    2) If a postcode is missing we just get an error. If it possible for it to report which cell or line the postcode is missing from?

    When I get the data in a different format, Sandy666's sheet will help I'm sure, and we'll manage those as best we can.

    Thanks for all your help,
    Mark

  27. #27
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,673

    Re: Address Cleaning.....

    Please Login or Register  to view this content.
    No complete solution for addresses without delimiters.
    Attached Files Attached Files

+ 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. Replies: 1
    Last Post: 02-18-2020, 11:48 PM
  2. Update Email Address from Global Address based on Cell Value
    By nasrulla in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-16-2019, 03:19 AM
  3. Match incomplete or mixed street/physical Address to a clean address format
    By vivek.budhram in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-21-2018, 03:31 PM
  4. [SOLVED] Cleaning Up Address and Street Names in Large Database
    By pick44 in forum Excel General
    Replies: 4
    Last Post: 10-21-2017, 11:12 AM
  5. [SOLVED] Run time error '1004': The address of this site is not valid. Check the address the addre
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2014, 06:59 AM
  6. Replies: 5
    Last Post: 03-07-2013, 07:10 AM
  7. Converting a complete, single column address into separate columns for ADDRESS, CITY, ST,
    By jeffrogerssn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2012, 10:34 AM

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