+ Reply to Thread
Results 1 to 5 of 5

Multiple tags within a cells

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Multiple tags within a cells

    Hi guys,

    I am interested in making a column within my tables with multiple tags, so that when I use Filter, any cell with that same tag will stay in the resulting table.

    Maybe an example will help.


    Imagine I have a table with
    A1: Name
    B1: Animals
    C1: Tags

    A2: Bob
    B2: Dog
    C2: Brown, 4 Legs, Spots, Old, Dog, No teeth, pees on the floor

    A3: Marley
    B3: Cat
    C3: Brown, Cat, 4 Legs, mean

    A3: Greg
    B3: Bird
    C3: Red, 2 Legs, French


    With the table above
    I would be interested in something similar to Filter (Data > Sort & Filter > Filter).
    Where If I:
    Picked "4 Legs", both Marley and Bob would show up.
    Picked "Dog", only Bob shows up.
    Picked "Red", only Greg shows up.
    Picked "pees on the floor", only Bob shows up.


    More or less, I want to be able to throw tags into a single cell, and then be able to sort using them. (I don't want to have a separate column for each category.)

    Ideally when creating a new Row, with Column C, Would be able to add any of the previous entries within other Column C Cells.
    The order of tags shouldn't matter:
    C2: Brown, 4 Legs, Spots, Old, Dog, No teeth, pees on the floor
    should be the same as
    C2: Brown, 4 Legs, Spots, Old, pees on the floor, Dog, No teeth

    etc.


    Is there a way to do this without VBA, is there a better program for something like this? Is there a way to make this using vba?

    Cheers guys,
    Jimmy
    Thanks,

    JimmyWilliams

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,421

    Re: Multiple tags within a cells

    Why can't you just use filters? On the filter drop-down there is an option Text Filters, and this leads to a second panel where you can select Contains and enter your text.

    Hope this helps.

    Pete

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Multiple tags within a cells

    You can do all of that with the Advanced Filter feature. It uses a separate Criteria range (column E for this example).

    In E1, put the header name of the column you want to filter on; Tags
    In E2, put your filter criteria and surround it with asterisks e.g.; *4 Legs*
    You could include multiple tag in E3 and E4 if you like. They act as OR criteria.

    Select your data in columns A:C
    Select from the menu Data\Filter\Advanced Filter
    Select E1:E? as the criteria range and Okay

    If you wanted to get fancy, you could put dropdown lists in the E2, E3 etc. to make it easier to select Tags. You could record the Advanced filter part and then assign that macro to a button on the sheet.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,725

    Re: Multiple tags within a cells

    Here is a VBA solution using two sheets
    Option Explicit
    
    Sub Crit()
        Dim s1 As Worksheet, s2 As Worksheet
        Set s1 = Sheets("Sheet1")
        Set s2 = Sheets("Sheet2")
        Dim i As Long, lr As Long, lr2 As Long
        Dim sCrit As String
        lr = s1.Range("A" & Rows.Count).End(xlUp).Row
        s2.Range("A1").CurrentRegion.ClearContents
        sCrit = InputBox("What are you searching for?")
        For i = 2 To lr
            lr2 = s2.Range("A" & Rows.Count).End(xlUp).Row
            If InStr(s1.Range("C" & i), sCrit) > 0 Then
                s1.Range("C" & i).EntireRow.Copy s2.Range("A" & lr2 + 1)
            End If
        Next i
        Application.CutCopyMode = False
    End Sub
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    405

    Re: Multiple tags within a cells

    Some pretty cool answers,

    I'm going to have to play around with this when I get a chance in the future. Will mark as solved afterwards.

    Thanks all!

+ 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] Tags for Coloring Table cells for EXCELFORUM
    By sourabhg98 in forum The Water Cooler
    Replies: 23
    Last Post: 04-06-2016, 06:19 AM
  2. Removing HTML tags (specifically <p> tags)
    By furiousbob in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-02-2015, 11:27 PM
  3. [SOLVED] Removing HTML tags (specifically <p> tags)
    By furiousbob in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-02-2015, 05:40 PM
  4. [SOLVED] Removing HTML tags (specifically <p> tags)
    By furiousbob in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2015, 05:40 PM
  5. [SOLVED] Question about forum rules, code tags, formula tags
    By Jacc in forum The Water Cooler
    Replies: 2
    Last Post: 09-11-2012, 08:42 AM
  6. What ways are there to tag cells and arrange by tags?
    By Advice Pro in forum Excel General
    Replies: 2
    Last Post: 03-27-2009, 06:52 PM
  7. Removing HTML tags from cells
    By rochdalemark in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-22-2005, 06:09 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