+ Reply to Thread
Results 1 to 6 of 6

Semi-colon Delimited String Contains Text Occuring in Column

  1. #1
    Registered User
    Join Date
    06-27-2014
    Location
    UK
    MS-Off Ver
    Pro 2003
    Posts
    13

    Semi-colon Delimited String Contains Text Occuring in Column

    Howdy,

    I have Column A in Sheet1 that contains semi-colon delimited strings (of brands) in a big list, and Column A in Sheet2 which contains a list of all possible brands, and next to them in Column B the corresponding category of the brands.

    (with 7 possible categories: Fragrance, Make Up, Skin Care, Sun & Tanning, Bath & Body, Hair, Gifts)

    i.e.

    Brand1; Brand2; Brand4
    Brand1; Brand3;
    and in the next sheet

    Brand1 | Fragrance
    Brand2 | Fragrance
    Brand3 | Make Up
    Brand4 | Sun & Tanning

    etc.

    I need to determine what categories are within the delimited lists in Column A in Sheet1. I imagined the best way to do this is to have 6 columns in Sheet1 with headers of the categories, and then 1 in the row of the string which contains a brand of that category.


    i.e.

    ################Fragrance| Make Up| Skin Care| Sun & Tanning| Bath & Body| Hair| Gifts
    Brand1; Brand2; Brand3;|1|1|0|0|0|0
    Brand1; Brand4;|1|0|0|1|0|0
    Kind of obtuse. Does this make sense? Is there a better way of doing this?

    Any questions and I'm happy to elaborate or provide a sample worksheet.


    Thank you for very much in advance for your attention and effort!
    Last edited by The831st; 08-04-2014 at 06:29 AM. Reason: typo

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Semi-colon Delimited String Contains Text Occuring in Column

    Hi, The831st,

    maybe you should attach a sample workbook with the sitution as is and a sheet showing the outcome.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    06-27-2014
    Location
    UK
    MS-Off Ver
    Pro 2003
    Posts
    13

    Re: Semi-colon Delimited String Contains Text Occuring in Column

    Hi Holger,



    Been busy today with end of month things.

    Attached is a workbook that demonstrates the format. The numbers between parentheses are the quantity of items from that brand. For this exercise, those numbers are ignored.


    Sheet1 is the column of bought brand lists,

    Sheet2 is the column of all brands with their attributed category,

    Sheet3 is what I'd like ideally for the outcome.


    There are about 1100 brands, though, and about 100,000 bought brand lists (some years worth of customer data). Thankfully, there's only those 7 categories.


    Thanks again!
    Attached Files Attached Files

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Semi-colon Delimited String Contains Text Occuring in Column

    Hi, The831st,

    maybe give this a try:
    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    06-27-2014
    Location
    UK
    MS-Off Ver
    Pro 2003
    Posts
    13

    Re: Semi-colon Delimited String Contains Text Occuring in Column

    Thanks for that Holger.


    One problem: it only puts a "1" into the Fragrance column. All the other columns remain at 0.

    Is it because there's a "(#)" in the lists in Sheet1 but not on the names in Sheet2?



    I didn't include it in the example (foolishly), but they are listed as "Brand1 (2); Brand2 (1); Brand3 (4)" in Sheet1.

    The numbers in the ('s are not important for this purpose now, however. They can be ignored. Perhaps I ignored them too much!

    Sorry about that. I should have been clearer.
    Last edited by The831st; 08-04-2014 at 05:52 AM.

  6. #6
    Registered User
    Join Date
    06-27-2014
    Location
    UK
    MS-Off Ver
    Pro 2003
    Posts
    13

    Re: Semi-colon Delimited String Contains Text Occuring in Column

    UPDATE:

    I've entered

    varRet = Application.Match(Trim(Left(varList(lngArr), InStr(varList(lngArr), "(") - 1)), ws2.Columns(1), 0)

    to attempt to remove the ('s and it worked.

    I think.

    Thank you very much Holger!

+ 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] Saving/Exporting Multiple Sheets as Multiple Semi-Colon Delimited CSV Files VBA
    By dylanrose in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 08-01-2014, 08:32 AM
  2. VBA Code to Save Excel File As Semi-Colon Delimited Format
    By mab1284 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-03-2014, 09:52 AM
  3. Replies: 2
    Last Post: 07-01-2013, 12:28 PM
  4. [SOLVED] How to determine no. of elements in a semi-colon string in Excel VBA?
    By zwieback89 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2012, 05:06 PM
  5. [SOLVED] How do I export Excel in a semi-colon delimited format?
    By Robert1105 in forum Excel General
    Replies: 4
    Last Post: 05-28-2005, 05:05 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