+ Reply to Thread
Results 1 to 12 of 12

How to split text & numbers in one cell to multiple cells

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-18-2015
    Location
    Mumbai, India
    MS-Off Ver
    MS Office 365
    Posts
    142

    How to split text & numbers in one cell to multiple cells

    Hi all,

    I need to split text in one cell to multiple cells. the text contains numbers as well & in fact the starting character within the cell is a number.

    see attached file & kindly provide solution

    Thanks
    Last edited by MaheshK5277; 02-23-2016 at 07:15 AM.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,651

    Re: How to split text & numbers in one cell to multiple cells

    Could you supply more rows of sample?
    Quang PT

  3. #3
    Forum Contributor
    Join Date
    12-18-2015
    Location
    Mumbai, India
    MS-Off Ver
    MS Office 365
    Posts
    142

    Re: How to split text & numbers in one cell to multiple cells

    Hi Bebo,

    rows added. see file attached

  4. #4
    Forum Contributor
    Join Date
    10-29-2014
    Location
    udaipur, rajasthan
    MS-Off Ver
    2013
    Posts
    365

    Re: How to split text & numbers in one cell to multiple cells

    or just simly use "Text to column" for ur given example

    Text to column-----------fixed width
    If answer helped you say Thanks by Add Reputation

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,632

    Re: How to split text & numbers in one cell to multiple cells

    Quote Originally Posted by udprocks View Post
    or just simly use "Text to column" for ur given example

    Text to column-----------fixed width
    It doesn't work because the columns are not of fixed width!
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  6. #6
    Forum Contributor
    Join Date
    10-29-2014
    Location
    udaipur, rajasthan
    MS-Off Ver
    2013
    Posts
    365

    Re: How to split text & numbers in one cell to multiple cells

    Quote Originally Posted by AliGW View Post
    It doesn't work because the columns are not of fixed width!
    yes, ali but that was for that first given example file.

  7. #7
    Forum Contributor
    Join Date
    10-29-2014
    Location
    udaipur, rajasthan
    MS-Off Ver
    2013
    Posts
    365

    Re: How to split text & numbers in one cell to multiple cells

    Quote Originally Posted by AliGW View Post
    It doesn't work because the columns are not of fixed width!
    yes, ali but that was for that first given example file sorry.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,632

    Re: How to split text & numbers in one cell to multiple cells

    Quote Originally Posted by udprocks View Post
    yes, ali but that was for that first given example file sorry.
    Yes, and it didn't work with that file, either!!! What would need to be in the second column were of different lengths.

  9. #9
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Microsoft® Excel® for Microsoft 365 MSO (Version 2503 Build 16.0.18604.20000) 64-bit
    Posts
    3,992

    Re: How to split text & numbers in one cell to multiple cells

    Ok Let try

    C6=LEFT(A6,FIND(" ",A6)-1)
    D6=TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A6,E6,""),F6,""),G6,""),H6,""),C6,""))
    E6=IFERROR(TRIM(RIGHT(SUBSTITUTE(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A6,F6," "),G6," "),H6," "))," ",REPT(" ",50)),50)),0)
    F6=IFERROR(-LEFT(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(A6,"-",REPT(" ",50)),50))," ",REPT(" ",50)),50),0)
    G6=IFERROR(TRIM(LEFT(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(SUBSTITUTE(A6,"-",REPT(" ",50)),ABS(F6),REPT(" ",50)),50))," ",REPT(" ",50)),50)),0)
    H6=IFERROR(TRIM(RIGHT(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(SUBSTITUTE(A6,"-",REPT(" ",50)),ABS(F6),REPT(" ",50)),50))," ",REPT(" ",50)),50)),0)

    and drag down
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  10. #10
    Forum Contributor
    Join Date
    12-18-2015
    Location
    Mumbai, India
    MS-Off Ver
    MS Office 365
    Posts
    142

    Re: How to split text & numbers in one cell to multiple cells

    Hi Ankur,

    Yes it works...many thanks bro...!!!

  11. #11
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: How to split text & numbers in one cell to multiple cells

    Maybe with a code ?


    Sub test()
    Dim lasstrow As Long, mystring As String, r As Integer, x As Integer, j As Integer, i As Integer
    Dim col1 As String, col2 As String, col3 As String, col4 As String, col5 As String, col6 As String
    lastrow = Range("A" & Rows.Count).End(xlUp).Row
    For i = 6 To lastrow
        mystring = Replace(Range("A" & i), ".", "")
        r = Len(mystring) - Len(Replace(mystring, " ", ""))
        ReDim mypos(r)
        j = 1
        For x = 1 To r
            mypos(x) = Application.Search(" ", mystring, j)
            j = mypos(x) + 1
        Next
        col1 = Left(mystring, mypos(1))
        col2 = Mid(mystring, mypos(1) + 1, mypos(r - 3) - (mypos(1) + 1))
        col3 = Mid(mystring, mypos(r - 3) + 1, mypos(r - 2) - mypos(r - 3) - 1)
        col4 = Mid(mystring, mypos(r - 2) + 1, mypos(r - 1) - mypos(r - 2) - 1)
        col5 = Mid(mystring, mypos(r - 1) + 1, mypos(r) - mypos(r - 1) - 1)
        col6 = Right(mystring, Len(mystring) - mypos(r))
        Range("C" & i).Resize(1, 6).Value = Array(col1, col2, col3, col4, col5, col6)
        j = 1
    Next
    End Sub
    Kind regards
    Leo

  12. #12
    Forum Contributor
    Join Date
    12-18-2015
    Location
    Mumbai, India
    MS-Off Ver
    MS Office 365
    Posts
    142

    Re: How to split text & numbers in one cell to multiple cells

    Hi leo,

    What a wonderful piece of work...works amazingly well...! Many thanks to you..

+ 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: 4
    Last Post: 07-21-2014, 10:33 AM
  2. [SOLVED] Split cell containing numbers and text
    By MATU70 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 03-23-2014, 04:12 AM
  3. [SOLVED] Delete text, split numbers to two cells and store as numbers
    By Steve_123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2014, 09:51 AM
  4. [SOLVED] Unable to split text and numbers into Separate Cells that have no space
    By BDavis in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-21-2013, 04:39 PM
  5. Split text and numbers into different cells
    By frutz in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-15-2009, 09:20 PM
  6. split numbers from text in cell
    By nicko54 in forum Excel General
    Replies: 4
    Last Post: 03-26-2009, 07:24 AM
  7. split text in one cell into multiple cells without breaking the wo
    By Prashant in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-06-2006, 04:48 AM

Tags for this Thread

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