+ Reply to Thread
Results 1 to 8 of 8

Searching Table and return first 10 matched results

  1. #1
    Registered User
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    87

    Searching Table and return first 10 matched results

    Hi,

    I need help with formulas that will return search results based on keywords. I wanted to use this application for household inventories. So the idea is if I needed an iPhone cable, I just type "iPhone cable" and it will list the first 10 row numbers matching that keyword. I used the match function to get the first match, but not sure how to ignore the first match found and continue to look down on the table to find the second match, then the 3rd and so forth.

    Thanks for your help guy. Sample data included.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Searching Table and return first 10 matched results

    The Match Function will not help you.

    You need to use an Array Formula

    Let me look at your sample Spreadsheet.

    Formula for B4
    =IF(SEARCH($C$2,Table1[Product Name])>0,ROW(Table1[SKU])-1,999)

    You probably need to enter the formula using ctrl Shift Enter
    Last edited by mehmetcik; 12-08-2020 at 12:09 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

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

    Re: Searching Table and return first 10 matched results

    I see that you have Ariston in both the Product Name and the Description columns of your table. Which of these columns do you want us to search through looking for a match with the keyword?

    Pete

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Searching Table and return first 10 matched results

    In B4:
    =IF(C5="","",ROWS($4:4))

    and in C4:
    =IFERROR(INDEX(Table!C:C,AGGREGATE(15,6,ROW(Table1[Product Name])/(ISNUMBER(SEARCH($C$2,Table1[Product Name]))),ROWS($1:1))),"")

    both copied down.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Registered User
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    87

    Re: Searching Table and return first 10 matched results

    Quote Originally Posted by Pete_UK View Post
    I see that you have Ariston in both the Product Name and the Description columns of your table. Which of these columns do you want us to search through looking for a match with the keyword?

    Pete
    Hi Pete, thank you for your reply, the search function is for the product name only.

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

    Re: Searching Table and return first 10 matched results

    A slightly different approach, which works in my old version of Excel (and will also work in newer versions):

    Put this formula in cell E2 of the Table sheet:

    =IF(ISNUMBER(SEARCH(Sheet2!$C$2,B2)),MAX(E$1:E1)+1,"-")

    Copy this down beyond your list of items, to allow for new data being added (the hyphens help to show where the formula is active).

    Then in Sheet2 you can use these formulae in the cells stated:

    B4: =IF(ROWS($1:1)>MAX(Table!$E:$E),"",ROWS($1:1))

    C4: =IFERROR(INDEX(Table!$B:$B,MATCH(ROWS($1:1),Table!$E:$E,0)),"")

    Copy these down as far as you need them (10 rows).

    Hope this helps.

    Pete

  7. #7
    Registered User
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    87

    Re: Searching Table and return first 10 matched results

    Thank you mehmetcik!

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

    Re: Searching Table and return first 10 matched results

    Thank you for the rep - glad to help.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark the thread as SOLVED.

    Pete

+ 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. Searching matched keyword is not working here
    By mdivk in forum Excel General
    Replies: 10
    Last Post: 04-23-2019, 05:56 AM
  2. Replies: 2
    Last Post: 06-01-2015, 06:23 PM
  3. [SOLVED] Formula to display associated matched results
    By hotwax in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-02-2014, 10:31 PM
  4. Searching a table for multiple criteria to return single result
    By erice in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-16-2014, 09:53 AM
  5. [SOLVED] Searching a Workbook to return multiple results
    By m3k1rk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2013, 06:12 AM
  6. Replies: 0
    Last Post: 07-21-2013, 05:12 AM
  7. Looping in Access and return calculated results from tables
    By dluhut in forum Access Tables & Databases
    Replies: 0
    Last Post: 04-22-2013, 12:16 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