Consulting

Results 1 to 5 of 5

Thread: Partial string search

  1. #1
    Site Admin VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,495
    Location

    Partial string search

    In the attached workbook, The Dodgy Bros (Zack & Jake) have the ability to find a Client Name based on a partial string search, thanks to a young backpacker who called himself Rory. Three days after putting young Rory on the bus to Darwin, Zack has had a change of mind and now wants the ability to also search by a partial IP Address. Since the current formula in cell F5 uses the Partial string in cell F2 to search the Table1 and returns the data to cells F5:I5 by using the following formula
     =IF($F$2<>"",CHOOSECOLS(FILTER(Table1,ISNUMBER(SEARCH($F$2,Table1[Client Name]),{1,2,3,4},"")
    How could Zack implement a partial search with the results also filling the cells F5:I5, or does it need to be another range?
    Attached Files Attached Files
    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

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,887
    Location
    Try this. It seems to work


    
    =IF($F$2<>"",
        IF(ISNUMBER($F$2),
            CHOOSECOLS(FILTER(Table1,ISNUMBER(SEARCH($F$2,Table1[IP_Address]))),{1,2,3,4}),
            CHOOSECOLS(FILTER(Table1,ISNUMBER(SEARCH($F$2,Table1[Client_Name]))),{1,2,3,4})
        )
    )
    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

  3. #3
    Site Admin VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,495
    Location
    Thank you Paul. Is that an either or type formula?
    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

  4. #4
    Administrator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,302
    Location
    You don't need to use CHOOSECOLS as the formula is already filtering the entire table, therefore, the entire table (all columns) will be returned in the result. If you were filtering a larger table (more columns) and wanted to return a select few, then CHOOSECOLS would be needed.

    As for the filter, if you wanted to use F2 for either the partial name OR the partial IP the you would need to use the + symbol to join the two criteria within the FILTER function.

    =FILTER(Table1,
      (ISNUMBER(SEARCH($F$2,Table1[Client_Name])))+
      (ISNUMBER(SEARCH($F$2,Table1[IP_Address])))
    )

  5. #5
    Site Admin VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,495
    Location
    Thank you georgiboy.
    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

Posting Permissions

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