+ Reply to Thread
Results 1 to 11 of 11

Split cell data

  1. #1
    Registered User
    Join Date
    11-26-2020
    Location
    Miami
    MS-Off Ver
    18
    Posts
    13

    Split cell data

    I'm trying to split the city, state and zip code into 3 different columns.

    I think I have to start from the right and find the first space to get the zip code. Then find the second space from right for the state and city.

    The zip code can vary in length and the city can be one or two words which is why I think the best way is the “space” delimiter and has to start from the right.

    The wizard doesn't work because the spaces vary due to cities being one or two words and there are no commas.



    Examples:

    DELRAY BEACH FL 33445

    BRONX NY 10466

    NEW YORK NY 10128-5517

    To be clear the city, st and zip are all in cell A1.

    I want
    A2 - City
    A3 - State
    A4 - Zip
    Last edited by MoeFoxx; 11-26-2020 at 01:01 PM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Split cell data

    One way.... B3:
    =TRIM(SUBSTITUTE(SUBSTITUTE(A3,D3,""),C3,""))

    c3:
    =TRIM(RIGHT(SUBSTITUTE(TRIM(SUBSTITUTE(A3,D3,""))," ",REPT(" ",50)),50))

    D3:
    =TRIM(RIGHT(SUBSTITUTE(A3," ",REPT(" ",50)),50))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

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

    Re: Split cell data

    An alternative is to use Power Query

    Please Login or Register  to view this content.
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    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

  4. #4
    Registered User
    Join Date
    11-26-2020
    Location
    Miami
    MS-Off Ver
    18
    Posts
    13
    Quote Originally Posted by Glenn Kennedy View Post
    One way.... B3:
    =TRIM(SUBSTITUTE(SUBSTITUTE(A3,D3,""),C3,""))

    c3:
    =TRIM(RIGHT(SUBSTITUTE(TRIM(SUBSTITUTE(A3,D3,""))," ",REPT(" ",50)),50))

    D3:
    =TRIM(RIGHT(SUBSTITUTE(A3," ",REPT(" ",50)),50))
    -----------

    I'll try this, but to be clear, the entire address field is on one line as provided. It's that cell I'm trying to split for a mailout.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Split cell data

    ?? Did you open the file?

  6. #6
    Registered User
    Join Date
    11-26-2020
    Location
    Miami
    MS-Off Ver
    18
    Posts
    13

    Re: Split cell data

    Still learning this site. alansidman gets the prize!! Power Query worked perfectly. Thank you. I even customized it some. Glad you pointed out this tool.
    Last edited by MoeFoxx; 11-26-2020 at 01:22 PM. Reason: Meh

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

    Re: Split cell data

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  8. #8
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Split cell data

    @MoeFoxx,

    Here is another set of formulas that should work. With your text in cell A1, put these formulas in the indicated cells...

    A2: =LEFT(A1,LEN(A1)-9-5*(MID(A1,LEN(A1)-5,1)<>" "))

    A3: =LEFT(RIGHT(A1,8+5*(MID(A1,LEN(A1)-5,1)<>" ")),2)

    A4: =RIGHT(A1,5+5*(MID(A1,LEN(A1)-5,1)<>" "))



    @Glenn... just noting you placed your formulas across whereas the OP asked for them to be down the column.
    Last edited by Rick Rothstein; 11-26-2020 at 05:02 PM.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Split cell data

    Rick. That was added at the most recent (of 4) edits of the original post... after I replied. If you look at the first sence of post 1 it (currently) states "separate columns".

    Moefoxx. Please don't edit posts after replies have been recieved. It causes confusion.

  10. #10
    Registered User
    Join Date
    11-26-2020
    Location
    Miami
    MS-Off Ver
    18
    Posts
    13
    Quote Originally Posted by Glenn Kennedy View Post
    Rick. That was added at the most recent (of 4) edits of the original post... after I replied. If you look at the first sence of post 1 it (currently) states "separate columns".

    Moefoxx. Please don't edit posts after replies have been recieved. It causes confusion.
    Sorry new here

  11. #11
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Split cell data

    Quote Originally Posted by Glenn Kennedy View Post
    Rick. That was added at the most recent (of 4) edits of the original post... after I replied. If you look at the first sence of post 1 it (currently) states "separate columns".
    Ah, okay, missed that. None of my posted formulas change though, they just have to be place in the correct destination cells. Assuming the text is in cell A1...

    B1: =LEFT(A1,LEN(A1)-9-5*(MID(A1,LEN(A1)-5,1)<>" "))

    C1: =LEFT(RIGHT(A1,8+5*(MID(A1,LEN(A1)-5,1)<>" ")),2)

    D1: =RIGHT(A1,5+5*(MID(A1,LEN(A1)-5,1)<>" "))

+ 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. VBA: Show Subtracted Figure In Cell When Cumulative Figure Is Entered
    By hrayani in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-28-2018, 11:29 AM
  2. [SOLVED] Using Linear Regression to predict a future event / performance figure / speed figure
    By Doofus1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-22-2017, 11:51 AM
  3. Replies: 1
    Last Post: 06-22-2017, 02:58 AM
  4. converting a monthly figure with growth to an annual figure
    By venvitale in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-04-2015, 05:23 PM
  5. Replies: 4
    Last Post: 02-03-2014, 08:05 AM
  6. Sum formula to exclude monthly budget figure when actual figure is entered
    By rocketmail in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-02-2013, 04:22 AM
  7. Calculating monthly sales figure required to make annual turnover figure
    By CatIsoSio Sky in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-27-2010, 04:42 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