+ Reply to Thread
Results 1 to 13 of 13

Data Extraction from Comma Separated Values in Excel Cell

  1. #1
    Forum Contributor
    Join Date
    07-19-2017
    Location
    usa
    MS-Off Ver
    2016 Professional Plus
    Posts
    128

    Data Extraction from Comma Separated Values in Excel Cell

    Hi Everyone!
    I have attached an excel workbook which contains two sheets named "before" and "after" respectively. The "before" sheet contains the sample data to work with and "after" sheet is the desired output for few entries in "before" sheet for the sake of example. Coming to my question, The "before" sheet contains some comma separated values. Each Comma separated value contains the shipping cost in dollar and the term either "available" or "not available". I want find out the lowest possible shipping cost out those comma separated values which contain the word "available" . Here we would ignore those comma separated values which contain the word "not available" and its of no use to use. I have attached the work book and you can easily understand by check it.

    Again many thanks in advance
    Attached Files Attached Files

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Data Extraction from Comma Separated Values in Excel Cell

    Hi,

    This array formula** should work for up to 5 occurrences of the word "available" within the string in A2:

    =MIN(IFERROR(0+MID(A2,FIND("ζ",SUBSTITUTE(A2,"$","ζ",{1;2;3;4;5}))+1,MMULT(FIND("ζ",SUBSTITUTE(PROPER(A2)&"ζ",{"$","Available"},"ζ",{1;2;3;4;5})),{-1;1})-2),""))

    Can easily be extended if you think there may be more than 5 such occurrences.

    Note also that the array constants in the above may need amending if you're not using an English-language version of Excel.

    Regards


    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Last edited by XOR LX; 02-02-2019 at 06:21 AM.
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Contributor
    Join Date
    07-19-2017
    Location
    usa
    MS-Off Ver
    2016 Professional Plus
    Posts
    128

    Re: Data Extraction from Comma Separated Values in Excel Cell

    Thanks for your response! Just asking that if I want to increase the number of occurence so should I add more numbers to this part=> 1;2;3;4;5 only?

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Data Extraction from Comma Separated Values in Excel Cell

    Yes, but if you think that it's potentially going to be a very large number (20+, perhaps), then it might be better to replace the necessary array constant, i.e.:

    {1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20}

    with an equivalent function which generates that array.

    Regards

  5. #5
    Forum Contributor
    Join Date
    07-19-2017
    Location
    usa
    MS-Off Ver
    2016 Professional Plus
    Posts
    128

    Re: Data Extraction from Comma Separated Values in Excel Cell

    The formula gives error "#VALUE" when applied on the cell containing "36-58 days US $2.02 Not available , Personalized Standard Shipping 20-40 days US $8.78 Not available , 7-15 days US $97.68 Available" .

  6. #6
    Forum Contributor
    Join Date
    07-19-2017
    Location
    usa
    MS-Off Ver
    2016 Professional Plus
    Posts
    128

    Re: Data Extraction from Comma Separated Values in Excel Cell

    On All of the following values the formula doesn't work:

    SunYou Economic Air Mail 30-50 days US $0.97 Not available , POS Malaysia 20-40 days US $3.01 Not available , 10 days US $113.66 Available
    POS Malaysia 20-40 days US $3.01 Not available , 7-10 days US $113.66 Available
    SunYou Economic Air Mail 30-50 days US $1.00 Not available , POS Malaysia 20-40 days US $3.01 Available , 7-10 days US $59.22 Available
    SunYou Economic Air Mail 30-50 days US $0.73 Not available , POS Malaysia 20-40 days US $2.63 Not available , 10 days US $113.66 Available
    POS Malaysia 20-40 days US $3.01 Not available , 7-10 days US $113.66 Available
    POS Malaysia 20-40 days US $3.01 Not available , 7-10 days US $113.66 Available
    SunYou Economic Air Mail 30-50 days US $0.73 Not available , POS Malaysia 41-60 days US $2.42 Available , 10 days US $113.66 Available
    SunYou Economic Air Mail 30-50 days US $0.52 Not available , POS Malaysia 40-56 days US $2.63 Not available , 10 days US $113.66 Available
    POS Malaysia 20-40 days US $3.01 Not available , 7-10 days US $113.66 Available

  7. #7
    Forum Contributor
    Join Date
    07-19-2017
    Location
    usa
    MS-Off Ver
    2016 Professional Plus
    Posts
    128

    Re: Data Extraction from Comma Separated Values in Excel Cell

    The formula also give the wrong answer on the following entry

    US $390000 Available , 36-58 days US $2.02 Not available , Standard Shipping 20-40 days US $8.78 Not available , 7-15 days US $97.68 Available

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Data Extraction from Comma Separated Values in Excel Cell

    Are you sure you followed my instructions about entering array formulas correctly?

    I don't get an error for any of those.

    Regards

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Data Extraction from Comma Separated Values in Excel Cell

    Try this one
    Enter formula in B2 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  10. #10
    Forum Contributor
    Join Date
    07-19-2017
    Location
    usa
    MS-Off Ver
    2016 Professional Plus
    Posts
    128

    Re: Data Extraction from Comma Separated Values in Excel Cell

    Hi Alkey, does this formula works for any number of comma separated values ? Thanks. I tested your formula and it worked

  11. #11
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Data Extraction from Comma Separated Values in Excel Cell

    @AlKey Doesn't this only work if the "Available" entries increase in value from left to right within the string?

    For example, what if you change the $3.72 in:

    21-36 days US $3.72 Available , Personalized Standard Shipping 26-43 days US $3.99 Available , 9-20 days US $133.00 Available

    to, for example, $10.00, i.e.:

    21-36 days US $10.00 Available , Personalized Standard Shipping 26-43 days US $3.99 Available , 9-20 days US $133.00 Available


    Your formula now returns 10, instead of the correct 3.99.

    Perhaps your assumption was right, but obviously the OP would need to confirm.

    Regards

  12. #12
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Data Extraction from Comma Separated Values in Excel Cell

    @XOR LX
    I don't really understand the purpose of manipulating the original data. The logic seams to be is to extract the value of the first smallest value that is Available.
    Last edited by AlKey; 02-03-2019 at 12:25 PM.

  13. #13
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Data Extraction from Comma Separated Values in Excel Cell

    What do you mean by "first smallest"? "First" or "Smallest" would make sense, but together I'm not sure what you mean.

    Regards

+ 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. [SOLVED] Sum values using vlookup with lookup cell containing comma separated values
    By tmalito in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-08-2019, 10:14 AM
  2. Replies: 1
    Last Post: 07-09-2018, 02:38 AM
  3. Doing a look up on a cell with comma separated values
    By floragraga in forum Excel General
    Replies: 3
    Last Post: 05-10-2017, 04:35 PM
  4. [SOLVED] Using comma separated values in a single cell
    By joerobb in forum Excel General
    Replies: 7
    Last Post: 01-16-2015, 08:45 AM
  5. Function for Comma-Separated Values within Cell
    By SoothSailor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-07-2014, 06:21 PM
  6. Replies: 3
    Last Post: 02-21-2013, 12:48 AM
  7. Resolved >>> Comma separated values in a cell
    By usr789 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-25-2007, 08:36 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