+ Reply to Thread
Results 1 to 22 of 22

Converting a string of delimited text options into a list of text options within a cell.

  1. #1
    Registered User
    Join Date
    08-13-2012
    Location
    MK, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Question Converting a string of delimited text options into a list of text options within a cell.

    Hi

    I have exported some questionnaire data into a spreadsheet. The yes/no straightforward answers are no problem, but I am having an issue with the multiple-choice answers as they have been exported in one cell delimited by semi-colons and hashes, eg

    Option One;#Option Two;#Option Three;#Option Four

    Because each cell relates to one questionairre, I am looking to create a list instead of the string in the one cell, eg:

    Option One
    Option Two
    Option Three
    Option Four

    I know how to do this manually but I have over 450 cells to do with up to 15 options in each, and really want to find a faster way.

    Can anyone help, and also are you able to put it in simple language? Something tells me it's a really simple process but currently it is passing me by, and I get easily confused when initally dealing with new jargon

    Thanks


    Pebbs

  2. #2
    Forum Contributor BenMiller's Avatar
    Join Date
    12-06-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: Converting a string of delimited text options into a list of text options within a ce

    Highlight your range. Go to Data>Text-To-Columns. Choose Delimited and use a semicolon as your delimiter.

  3. #3
    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: Converting a string of delimited text options into a list of text options within a ce

    Hi,

    One approach would be to select the whole column and then use Find/Replace to replace all ';' with nothing. Then use Data Text to columns using the delimiter option and using the # sign as the delimiter.

    Then if you want vertical lists rather than columns of values use Copy and paste special transpose to create turn the data through 90 degrees
    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.

  4. #4
    Registered User
    Join Date
    08-13-2012
    Location
    MK, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Converting a string of delimited text options into a list of text options within a ce

    That's perfect, thank you so much

    ---------- Post added at 11:30 AM ---------- Previous post was at 11:26 AM ----------

    I just tried it again - this option would be great but pops everything into different columns, overwriting what was already there. I need it all in the same cell

  5. #5
    Forum Contributor BenMiller's Avatar
    Join Date
    12-06-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: Converting a string of delimited text options into a list of text options within a ce

    So you want it on four separate lines within the same cell?

  6. #6
    Registered User
    Join Date
    08-13-2012
    Location
    MK, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Converting a string of delimited text options into a list of text options within a ce

    Thanks Richard
    Your solution has the same problem as Ben, in that it takes the data out of the original cell and would require copy and pasting to get it all back into the one cell again. I would have a ridiculous amount of data to do that with and don't have time. I saw someone do it once so know it's possile... somehow!
    Pebbs

    ---------- Post added at 11:34 AM ---------- Previous post was at 11:34 AM ----------

    Quote Originally Posted by BenMiller View Post
    So you want it on four separate lines within the same cell?
    Yes please!

  7. #7
    Forum Contributor BenMiller's Avatar
    Join Date
    12-06-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: Converting a string of delimited text options into a list of text options within a ce

    I'm sorry. That would require a macro, and I'm not much of a programmer.

  8. #8
    Registered User
    Join Date
    08-13-2012
    Location
    MK, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Converting a string of delimited text options into a list of text options within a ce

    That's cool, thanks for helping Ben

  9. #9
    Registered User
    Join Date
    08-13-2012
    Location
    MK, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Converting a string of delimited text options into a list of text options within a ce

    Is there a way to avoid macros, anyone?

  10. #10
    Forum Contributor BenMiller's Avatar
    Join Date
    12-06-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: Converting a string of delimited text options into a list of text options within a ce

    Not to my knowledge. Is there a reason you want them all on the same cell? It is never recommended to put two pieces of data in the same cell.

  11. #11
    Registered User
    Join Date
    08-13-2012
    Location
    MK, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Converting a string of delimited text options into a list of text options within a ce

    I have a piece of code to seperate everything else in a different section of the spreadsheet, which I can probably use as is but knowing the way my boss thinks he wil want to see everything at a glance. Currently the date will not display because the width of the cell is too small for the string.
    The annoying thing is that I have seen it done before so know it's possible, but am missing a step in the process. I will keep trying!

  12. #12
    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: Converting a string of delimited text options into a list of text options within a ce

    Hi,

    The only non macro way is to use the Find/Replace and then delimiter as explained before.
    First split the single column into up to 15 individual columns. If you already have data to the right then just add a new worksheet and copy your column there first and work there.

    Once you have 15 columns of data in A:O in P1 enter the formula

    A1&CHAR(10)&B1&CHAR(10)&C1&CHAR(10)&D1....&Char(10)&O1

    This will rejoin all your values back into a single cell introducing a new line character. Copy this formula down as far as necessary
    Then use Copy Paste Special values to convert column P back to values and then use Text Wrap to format column P.

    If necessary copy this column back to your original sheet.

  13. #13
    Registered User
    Join Date
    08-13-2012
    Location
    MK, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Converting a string of delimited text options into a list of text options within a ce

    Hi Richard
    This is where I prove how non-Excel-literate I am: when entering the code, what do I need to add to it in order for it to recognise the instruction? Eg when doing an addition between cells you first type in '=SUM...'

    Thanks

  14. #14
    Forum Contributor BenMiller's Avatar
    Join Date
    12-06-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: Converting a string of delimited text options into a list of text options within a ce

    Start it with an equals sign =

    Richard, brilliant - I did not think of using CHAR(10) and pasting values ... that's great

    Technically, you can just use

    =SUBSTITUTE(A1,";#",CHAR(10)) and copy/paste values - without having to first split the columns.

  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: Converting a string of delimited text options into a list of text options within a ce

    HI,

    No it's not strictly correct to call it an addition of cells. You are 'concatenating' or joining cells.

    Just enter the formula I gave you with an = sign in front of the A1.

    ---------- Post added at 06:27 PM ---------- Previous post was at 06:22 PM ----------

    @Ben
    Good catch. I didn't spot that one!

    @Pebbs
    Please note

  16. #16
    Registered User
    Join Date
    08-13-2012
    Location
    MK, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Converting a string of delimited text options into a list of text options within a ce

    Thanks Guys

    For some reason, it was nearly there - the values just had an odd hollow box symbol next to them, but when I copied and pasted as just a value it worked.

    You are both just made my day go from being pretty rough to having something opretty decent and satisfying to smile about, thank you so very much

    Thanks again

    Nikki, AKA Pebbs

  17. #17
    Forum Contributor BenMiller's Avatar
    Join Date
    12-06-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: Converting a string of delimited text options into a list of text options within a ce

    Quote Originally Posted by Richard Buttrey View Post
    @Ben
    Good catch. I didn't spot that one!
    To make it accurate, the OP mentioned that some cells had just one value. In that case, the new column should have:

    =IF(ISNUMBER(FIND(";#",A1)),SUBSTITUTE(A1,";#",CHAR(10),A1)

    or

    =CHOOSE((ISNUMBER(FIND(";#",A1)))+1,A1,SUBSTITUTE(A1,";#",CHAR(10))

  18. #18
    Registered User
    Join Date
    08-13-2012
    Location
    MK, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Converting a string of delimited text options into a list of text options within a ce

    Hi

    @Richard - I had wondered if it was concatenating but then I assumed that was just if they were side by side.

    Just out of curiosity seeing as you're on a roll, I am having to click in each field and press return in order to get the list to display. Is there any reason for this or any way around it? If not, don't worry - you've already saved me hours worth of work.

    Thanks

  19. #19
    Forum Contributor BenMiller's Avatar
    Join Date
    12-06-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: Converting a string of delimited text options into a list of text options within a ce

    As Richard pointed out before, highlight all the cells (after you pasted values), right-click>format cells>tab over to Alignment>Check "Wrap Text".
    Last edited by BenMiller; 08-13-2012 at 01:49 PM.

  20. #20
    Registered User
    Join Date
    08-13-2012
    Location
    MK, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Converting a string of delimited text options into a list of text options within a ce

    For some reason the IF statement does not work on my system - I think it is looping or something like that.

    The CHOOSE option works fine and as you say only picks out the data that is there meaning I can have individual records.

    What does OP mean by the way?

    Cheers

  21. #21
    Forum Contributor BenMiller's Avatar
    Join Date
    12-06-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: Converting a string of delimited text options into a list of text options within a ce

    Quote Originally Posted by Pebbs1981 View Post
    For some reason the IF statement does not work on my system - I think it is looping or something like that.

    The CHOOSE option works fine and as you say only picks out the data that is there meaning I can have individual records.

    What does OP mean by the way?

    Cheers
    Sorry, I left out a closing parentheses. Should be:

    =IF(ISNUMBER(FIND(";#",A1)),SUBSTITUTE(A1,";#",CHAR(10)),A1)

    OP means Original Post(er)

  22. #22
    Registered User
    Join Date
    08-13-2012
    Location
    MK, England
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Converting a string of delimited text options into a list of text options within a ce

    Quote Originally Posted by BenMiller View Post
    As Richard pointed out before, highlight all the cells (after you pasted values), right-click>format cells>tab over to Alignment>Check "Wrap Text".
    Ah sorry, I missed that. - was too busy trying to figure out the code.

    Thank you so much

  23. #23
    Forum Contributor BenMiller's Avatar
    Join Date
    12-06-2011
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    254

    Re: Converting a string of delimited text options into a list of text options within a ce

    No problem ... the real genius was Richard; I did not think of inserting the line break as a character...

+ 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