+ Reply to Thread
Results 1 to 13 of 13

How do I add dashes in apartment addresses?

  1. #1
    Registered User
    Join Date
    07-16-2012
    Location
    San Francisco, California
    MS-Off Ver
    Excel X for Mac
    Posts
    6

    How do I add dashes in apartment addresses?

    I have a list in which some apartment addresses are formatted as B103 and some as B-103. How do I tell the list to add a dash every time there is a letter, directly followed by a number?

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: How do I add dashes in apartment addresses?

    Assuming your list starts in A2, then you can put the following in, e.g., B2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    And copy down.
    Last edited by Søren Larsen; 07-16-2012 at 05:13 PM. Reason: Apparently I can't count
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  3. #3
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: How do I add dashes in apartment addresses?

    Assuming Cell A1 is the raw data, try this:

    =IF(ISERR(FIND("-",A1)),LEFT(A1,1)&"-"&RIGHT(A1,LEN(A1)-1),A1)
    Click on star (*) below if this helps

  4. #4
    Registered User
    Join Date
    07-16-2012
    Location
    San Francisco, California
    MS-Off Ver
    Excel X for Mac
    Posts
    6

    Re: How do I add dashes in apartment addresses?

    Hi Søren,
    Thanks for your reply. Unfortunately I'm a newbie and don't totally understand your answer. This is a voter list with lots of fields and the addresses are all in one field, so it isn't "B" in A2 and "103" in B2. They are both in the same field. How do I handle this?
    Thank you.

  5. #5
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: How do I add dashes in apartment addresses?

    The A2 refers to the field where your address is placed. The B2 is just an example of where you can put the formula; you can put whereever you want, as long as it refers to your address field. Did that help or add to the confusion?

  6. #6
    Registered User
    Join Date
    07-16-2012
    Location
    San Francisco, California
    MS-Off Ver
    Excel X for Mac
    Posts
    6

    Re: How do I add dashes in apartment addresses?

    OK, I added a column after the address column. What do I do next? Remember, I'm a newbie and need step-by-step instructions.
    Thank you.

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How do I add dashes in apartment addresses?

    is it always b?
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  8. #8
    Registered User
    Join Date
    07-16-2012
    Location
    San Francisco, California
    MS-Off Ver
    Excel X for Mac
    Posts
    6

    Re: How do I add dashes in apartment addresses?

    No, these are real apartment buildings in my district. They are whatever number the apartment complex has: A-102; B-209 etc. The problem is that when some people register to vote, they write: "C201" and some people write "C-201." I want to standardize them to all "C-201."

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How do I add dashes in apartment addresses?

    Hello SuzieQ333,

    Welcome to the Forum!

    To provide you with a working solution, it would be best if you can provide of samples of the data. Of course, uploading the workbook would be the best option. However you decide, please redact any sensitive information before you post it.

    To Attach a File:

    1. Scroll down to the window below your post Additional Options
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How do I add dashes in apartment addresses?

    try this see attached
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-16-2012
    Location
    San Francisco, California
    MS-Off Ver
    Excel X for Mac
    Posts
    6

    Re: How do I add dashes in apartment addresses?

    I have attached a snippet. As you can see, with these apartments, there is an added issue of "#". I am walking door-to-door, so I need all of the apartment numbers to be sequential, so I don't have to physically walk around the complex twice. Can you make a formula tfor this?

    Thank you1
    Attached Files Attached Files

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How do I add dashes in apartment addresses?

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    then sort by that column like this
    mind you this is getting large it would probably be better to spilt the formula to two columns
    Attached Files Attached Files
    Last edited by martindwilson; 07-19-2012 at 10:10 AM.

  13. #13
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How do I add dashes in apartment addresses?

    Hello SuzieQ333,

    I have added a button to your workbook to run the "normalize" macro. This will format all the data in column "A" that is an apartment address. Once the addresses have been modified, they are sorted in ascending order. If you need help moving this over to your actual workbook, let me know.
    Please Login or Register  to view this content.
    EDIT: After noticing you are using a Mac, this code will probably not work with your OS. One of the big compatibility drawbacks is Mac can not call these Scripting object libraries like a PC. A workaround using Apple Script would be possible but difficult because UNIX Regular Expression syntax is very different and the remaining macro code would have to be translated as well.
    Attached Files Attached Files
    Last edited by Leith Ross; 07-19-2012 at 01:41 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