+ Reply to Thread
Results 1 to 5 of 5

Convert Comma Separated Values to matching Comma Separated Strings

  1. #1
    Registered User
    Join Date
    08-21-2012
    Location
    Modesto, CA
    MS-Off Ver
    Excel 2007
    Posts
    45

    Convert Comma Separated Values to matching Comma Separated Strings

    Thanks in advance for your review of this query!

    Looking to convert a group of values in a single cell that are separated by commas into a matching list of strings separated by commas.

    For instance, I'm using the following formula when only two values have been entered :

    =TRIM(CONCATENATE(INDEX(M:M,MATCH(VALUE(LEFT(C4,FIND(",",C4)-1)),L:L,0))," ",INDEX(N:N,MATCH(VALUE(LEFT(C4,FIND(",",C4)-1)),L:L,0))," & ",INDEX(N:N,MATCH(VALUE(RIGHT(C4,LEN(C4)-FIND(",",C4)-1)),L:L,0))))

    33205, 90149 > flavors : banana & licorice

    Is there a "kinder" solution for this? What if more than two values are entered?

    33205, 78596, 90149 > flavors : banana, pumpkin, licorice

    See attached table for values and strings.

    artikyulashun
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Convert Comma Separated Values to matching Comma Separated Strings

    Would M:M ever contain anything other than flavors : ? Also, if there are only 2 codes in col C, it appears you want the 2 corresponding values from N:N separated by &, but it there are 3 or more you want a comma-separated list.

    This is an example of something Excel does very poorly, expecially in a version as old as Excel 2007. From my perspective, you'd be better off using VBA.

  3. #3
    Registered User
    Join Date
    08-21-2012
    Location
    Modesto, CA
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Convert Comma Separated Values to matching Comma Separated Strings

    Fair observation on the "&". I think a comma for each flavor would suffice.

    No. M:M would contain other naming conventions.

    Honestly, I'm not versed in VBA. Do you have something in mind?

  4. #4
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Convert Comma Separated Values to matching Comma Separated Strings

    The VBA looks like this.

    Sorry, correction below.

    Please Login or Register  to view this content.
    I'm also attaching a workbook to show how it works.
    Attached Files Attached Files
    Last edited by hrlngrv; 12-01-2020 at 02:51 PM. Reason: correction

  5. #5
    Registered User
    Join Date
    08-21-2012
    Location
    Modesto, CA
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: Convert Comma Separated Values to matching Comma Separated Strings

    Appreciate the coding that went into this hrlngrv. I'll roll up my sleeves and see if I can follow along ...

+ 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: 3
    Last Post: 12-26-2019, 09:59 AM
  2. Converting Comma and Dash-Separated Number Strings to Binary
    By ExcelWashington in forum Excel General
    Replies: 6
    Last Post: 03-01-2019, 07:40 AM
  3. [SOLVED] Combine comma separated strings
    By JimmyA in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-09-2016, 01:21 PM
  4. Replies: 3
    Last Post: 09-25-2014, 02:14 PM
  5. Programatically Convert comma separated 'Text to Column'
    By super_duper_guy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-01-2012, 08:04 PM
  6. Convert range of cells to comma separated list
    By maw230 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-23-2012, 06:03 PM
  7. Return Y/N after matching from multiple lookup values separated by comma
    By indoglans in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2011, 03:13 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