+ Reply to Thread
Results 1 to 10 of 10

Categorising rows of data based on the text contained

  1. #1
    Registered User
    Join Date
    12-03-2010
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Categorising rows of data based on the text contained

    I've got a large sheet of URL's which I would like to categorise into the content sections e.g. products, downloads etc.

    At the moment i'm using a very long IF(ISNUMBER(SEARCH function to say if url contains "/download/" call it "Download", if not, does it contain "Products", if so, call it "Products" etc.

    Ideally I'm trying to find some VBA code that I could call through a user function, whereby it searches the selected cell for a list of values on another sheet if it finds that value it returns a specific text if not it searches in a different range and returns another piece of text if it is found.

    I've got this piece of code:

    Please Login or Register  to view this content.
    It starts the job, but doesn't quite achieve what I want. Any help would be much appreciate. Thanks.

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Categorising rows of data based on the text contained

    hi foxyfmu, wlcome to Excelforum, what is the searched keywords list, can you post sort of sample sheet with original data and result you need to obtain? Do you need UDF only or it can be a macro code?

  3. #3
    Registered User
    Join Date
    12-03-2010
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Categorising rows of data based on the text contained

    Hi, thanks!

    Sure find attached. Put an example in column C of what would be the outcome. Further explanation on sheet2.

    Let me know if you need further clarity.

    No it doesn't have to be a UDF, if there's another solution which works just as well.

    thanks!
    classify_example.xlsx

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Categorising rows of data based on the text contained

    can the list be repositioned (kind of sorted, first line becomes 16th etc.) or it is important to have initial order of the list?

  5. #5
    Registered User
    Join Date
    12-03-2010
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Categorising rows of data based on the text contained

    List can be in any order, so long as it can be repositioned in the future with new data easily

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Categorising rows of data based on the text contained

    option to make it, please check attachment, press Run
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-03-2010
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Categorising rows of data based on the text contained

    That's fantastic! Thanks very much!

    How easy is it to have a third, fourth..set of criteria?

  8. #8
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Categorising rows of data based on the text contained

    I've modified it a bit.

    The keywords should start from row 1 and go continuously by columns. You need just add "marker text" in the underlined line (I did it for example - "test" - marker for the third column of keywords

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by watersev; 09-28-2012 at 05:49 AM.

  9. #9
    Registered User
    Join Date
    12-03-2010
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Categorising rows of data based on the text contained

    Ah that's amazing thanks so much!

    How easy is this to code? Like what level of VBA is this sort of script? Really need to learn more.


    Thanks again.

  10. #10
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Categorising rows of data based on the text contained

    I don't know what level it is, never thought of the level of the code. The code is definitely not complicated in terms of its algorithm. It uses advanced filter and all its actions can be repeated manually.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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