+ Reply to Thread
Results 1 to 7 of 7

Remove all spaces between words

  1. #1
    Registered User
    Join Date
    07-06-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Remove all spaces between words

    I have a large list of Suburbs, postcodes and State. The postcodes in column A, suburbs in column B and the state in column C. I need to generate a unique code for each suburb and it can only be 4 digits. I would like to use the first number in the postcode as the first digit and 3 letters from the suburb name to make up the last 3 digits. Is there a way l can get Excel to generate the code? I will also need to remove any spaces in the text as some suburbs are more than one word. Is there a function that will remove all spaces from between words. I have looked at the Trim function but it only removes spaces after.

    I have attached an example of my data.
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,220

    Re: Remove all spaces between words

    Remove spaces in your B Column with the Substitute Function.

    =Substitute(B2," ","")

  3. #3
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Kalgoorlie Australia
    MS-Off Ver
    Excel 2007/10
    Posts
    251

    Re: Remove all spaces between words

    Melf 72
    You say you want to create a unique code for each suburb, I would of thought you already have that within the post code.
    If you use the first digit from the post code and the first three letters from the suberb, I think it will create a major headache for you because within the short list you have supplied there is 6280 ABBA RIVER (6ABB) and there is 6280 ABBEY (6ABB) or are these two places the same place?
    Regards
    Peter
    Looking through the phone book there are countless examples were the above procedure will create duplicate codes,
    BEVERLRY PARK 2217 (2BEV)
    BEVERLEY HILLS 2209 (2BEV)
    CABRAMATTA 2166 (2CAB),
    CABRAMURRA 2629 (2CAB)
    Regards
    Peter
    Last edited by peterjuhnke; 09-06-2010 at 07:34 PM.

  4. #4
    Registered User
    Join Date
    07-06-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Remove all spaces between words

    Thanks MarvinP. That issue is solved.

  5. #5
    Registered User
    Join Date
    07-06-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Remove all spaces between words

    Hi Peter

    That is exactly my issue as suburbs can have the same postcode so l cant use the whole postcode. Each suburb must have it's own unique 4 digit code and l then have the other issue of suburbs that start with the same letters and are in the same state. Can Excel generate a unique codes? Even if it a number or a combination of numbers and letters?

  6. #6
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Kalgoorlie Australia
    MS-Off Ver
    Excel 2007/10
    Posts
    251

    Re: Remove all spaces between words

    If you combined the complete post code and complete suberb name, this would give an unique code but this may be to long in some cases, CABRAMATTA 2166, 2166CABRAMATTA
    CABRAMURRA 2629 (2629CABRAMURRA), in which case all you have to do is use MArvinP's solution ,or highlight the column, Ctrl F and use the replace tab, in the top " ", in the bottom "".
    Regards
    Peter
    Sorry in the example you have supplied use =SUBSTITUTE((A2&B2)," ","")
    REGARDS
    Peter
    Attached Files Attached Files
    Last edited by peterjuhnke; 09-06-2010 at 08:04 PM.

  7. #7
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Kalgoorlie Australia
    MS-Off Ver
    Excel 2007/10
    Posts
    251

    Re: Remove all spaces between words

    hello again
    Or this
    If you want it in alpha-numerical order then instead of a2&b2&c2 ,use b2&a2&c2
    Attached Files Attached Files
    Last edited by peterjuhnke; 09-06-2010 at 08:18 PM.

+ 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