+ Reply to Thread
Results 1 to 21 of 21

Excel Split Single Cell Array into Multiple Cells

  1. #1
    Registered User
    Join Date
    06-08-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    11

    Excel Split Single Cell Array into Multiple Cells

    An application I use exports strings of data in an array in one cell, like so:

    "data1"= value1; "data2"= value2; "data3"= value3; "data4"= value4; "data5"= value5;

    I'd like an equation or macro or something that could split it like this:

    Please Login or Register  to view this content.
    Is this possible?

    Excel 2003 on Windows XP
    Last edited by devinpitcher; 06-08-2011 at 11:17 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Excel Split Single Cell Array into Multiple Cells

    Hi,

    Are the Value items numeric, alpha or a mixture?

    How many cells are involved - presumably more than the single cell you mention above. And in which case how do you want the second and subsequent cells parsed. Do other cells have exactly the same 'data1', 'data2' items or do they have further unique values like 'data6', 'data7' etc which extends the table further to the right.

    It would help if you could upload a representative example showing the before and after position.

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Excel Split Single Cell Array into Multiple Cells

    This will do it of a single cell:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-08-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Excel Split Single Cell Array into Multiple Cells

    This is a better representation:

    Please Login or Register  to view this content.
    This is a sample of the data:

    "search-terms1" = Chinese jade; "search-terms2" = Chinese archers; "search-terms3" = Antique jade; "search-terms4" = Asian jade; "search-terms5" = China history;

  5. #5
    Registered User
    Join Date
    06-08-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Excel Split Single Cell Array into Multiple Cells

    If possible, an equation would work better for this situation, but a macro could work, if it could do this to all rows in the database.

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Excel Split Single Cell Array into Multiple Cells

    Please address Richard's post.

  7. #7
    Registered User
    Join Date
    06-08-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Excel Split Single Cell Array into Multiple Cells

    Are the Value items numeric, alpha or a mixture? Numbers and letters. No symbols as far as I know.

    How many cells are involved? There are hundred of rows, and there will be a result of 5 columns per row. search-terms1 - search-terms5.

    And in which case how do you want the second and subsequent cells parsed. I'm looking for the result to be 5 new columns, each with the data from the array.

    Do other cells have exactly the same 'data1', 'data2' items or do they have further unique values like 'data6', 'data7' etc which extends the table further to the right. Just data1 - 5, which will actually be called search-terms1 - 5

  8. #8
    Registered User
    Join Date
    06-08-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Excel Split Single Cell Array into Multiple Cells

    Here is a database sample.
    Attached Files Attached Files

  9. #9
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Excel Split Single Cell Array into Multiple Cells

    Results on sheet2:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    06-08-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Excel Split Single Cell Array into Multiple Cells

    Could you embed that into a excel document or something for me? I get an error when I try to run it.

  11. #11
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Excel Split Single Cell Array into Multiple Cells

    Hi,

    Try adding a -1 to the For Loop line in Stephen's code, i.e.

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    06-08-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Excel Split Single Cell Array into Multiple Cells

    I'm getting "Object required" for this line:

    With Sheet2.Range("A" & Rows.Count).End(xlUp)(2)

  13. #13
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Excel Split Single Cell Array into Multiple Cells

    Hi,

    Does
    Please Login or Register  to view this content.
    help?

  14. #14
    Registered User
    Join Date
    06-08-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Excel Split Single Cell Array into Multiple Cells

    Nope.

    I just made a new Macro, pasted this in:

    Please Login or Register  to view this content.
    ... and tried to run it. Did I forget something? Do I need to select something before running? Runtime error 424.

  15. #15
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Excel Split Single Cell Array into Multiple Cells

    Hi,

    Are you sure your data is on Sheet2? That's the VBA named Sheet2. This is not necessarily the "Sheet2" tab name or even the second sheet counting from the left in the Excel App.

    Regards

  16. #16
    Registered User
    Join Date
    06-08-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Excel Split Single Cell Array into Multiple Cells

    I have Sheet1 and Sheet2. With the data on either 1 or 2, when I run it, I get that error.

    Could somebody use the Template I uploaded and attach a working Macro to it possibly? I'm good with Excel, just never used Macros before.

  17. #17
    Registered User
    Join Date
    06-08-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Excel Split Single Cell Array into Multiple Cells

    Ok, I made a new document and tried again. It worked without an error, but all it did was copy the data over to Sheet2 in the same format.
    Last edited by devinpitcher; 06-08-2011 at 01:48 PM.

  18. #18
    Registered User
    Join Date
    06-08-2011
    Location
    Michigan
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Excel Split Single Cell Array into Multiple Cells

    Solved. I checked my post on Stack Overflow, and they came up with something that worked.
    Last edited by devinpitcher; 06-09-2011 at 08:27 AM.

  19. #19
    Registered User
    Join Date
    12-06-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Excel Split Single Cell Array into Multiple Cells

    Hi All,

    I have one queary ,In may collage 4Persons are got same marks as below.

    Name University Markas Markas Plan
    Nagaraju/Srinivas/Madu/Vijai Nu 25 30 40


    I want to split these records as below .Is it possiable ,Please revert with code

    Name University Markas Markas Plan
    Nagaraju Nu 25 30 40
    Srinivas Nu 25 30 40
    Madu Nu 25 30 40
    Vijai Nu 25 30 40

    Thanks,

    Nagaraju

  20. #20
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Excel Split Single Cell Array into Multiple Cells

    Nagaraju,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  21. #21
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Excel Split Single Cell Array into Multiple Cells

    Quote Originally Posted by devinpitcher View Post
    An application I use exports strings of data in an array in one cell, like so:

    "data1"= value1; "data2"= value2; "data3"= value3; "data4"= value4; "data5"= value5;

    I'd like an equation or macro or something that could split it like this:

    Please Login or Register  to view this content.
    Is this possible?

    Excel 2003 on Windows XP
    I realize that this thread is over a year old, but nobody offered a formula solution, so here is one based on the workbook in post #8.

    It might be of use to others searching the forum.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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