Consulting

Results 1 to 4 of 4

Thread: Finding Keywords from Text String - Formula

  1. #1

    Finding Keywords from Text String - Formula

    All-

    I have a list of descriptions on tab one and a list of keywords on tab two. Is there a formula that looks up my keywords on tab two, against the list on tab one? I'm trying to find where they match.

    For example, if I lookup my keyword 'BRP120AF' on tab one, it will match rows 1423, 1424, 1425 (CIR BRP120AF PLUG ON 1P20A AFC).

    Either highlighting these rows, or having an 'X' in a blank column works.

    Any ideas? Sample file attached.

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,054
    Location
    I have removed the "Solved" signage as no solution has been provided so far
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,642
    CF:

    PHP Code:
    =NOT(ISERR(SEARCH("BRP120AF";$A1))) 
    Applies to $A$1:$A$2000

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    I did it so that double clicking on a tag on Sheet2 will color the corresponding Sheet1 values green

    Option Explicit
    
    
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
        Dim rLookup As Range, rSearch As Range, rFirstOne As Range
        Dim i As Long, n As Long
        Dim sLookup As String
        
        Set rLookup = Target.Cells(1, 1)
        
        If rLookup.Column <> 1 Then Exit Sub
        
        sLookup = rLookup.Value
        If Len(sLookup) = 0 Then Exit Sub
        
        Set rSearch = Worksheets("Sheet1").Cells(1, 1).CurrentRegion.Columns(1)
        
        With rSearch
            .Interior.ColorIndex = xlColorIndexNone
            
            n = 0
            Set rFirstOne = Nothing
            For i = 1 To .Rows.Count
                If InStr(.Cells(i, 1).Value, sLookup) > 0 Then
                    .Cells(i, 1).Interior.Color = vbGreen
                    n = n + 1
                    If rFirstOne Is Nothing Then Set rFirstOne = .Cells(i, 1)
                End If
            Next i
        End With
        
        If Not rFirstOne Is Nothing Then
            rFirstOne.Parent.Select
            Application.Goto rFirstOne, True
        End If
        
        MsgBox n & " matches found for " & sLookup
    
    
    End Sub
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •