+ Reply to Thread
Results 1 to 16 of 16

Help creating search box

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Help creating search box

    Hello all. I am using http://www.excel-easy.com/examples/search-box.html as a reference and I almost have it figured out...but not quite. In the attached file, I want the matching names from column "A" to be displayed in column "E" where the following formula resides:
    =IFERROR(VLOOKUP(D4,$A$4:$C$500,-3,FALSE),"")
    I used -3 thinking the column being referenced was the one I wanted to use to get the matched results. Any help is appreciated.

    Andrew
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Help creating search box

    Hello Andrew
    Take a look at the attached example. I've changed the formulas (blue cells) to how I would perhaps do this as your Vlookup formula won't work in the way you are using it with a negative column reference.

    Hope this helps.
    DBY
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Help creating search box

    Thanks for the quick reply and solution DBY!! It works as desired on the test file so time to try it on the production file.

  4. #4
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Help creating search box

    Glad to have helped, good luck with it and thanks for the Rep mark.

  5. #5
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Help creating search box

    I reopened this thread to get a tweak to the solution. Currently, the matched names are displayed in a separate column. Because the original data is linked to their respective sheets and has conditional formatting to change the colors, It would be better if the column being searched which is "A", actually displays the matching results so the links and colors are maintained with the search results. There are over 500 individual cells in column "A" to be searched so it is important to maintain the links to the sheets in the search results to easily navigate back and forth.

    EDIT: The list in column "A" is created dynamically so whatever formula or VBA is used to generate the search needs to be dynamic as well.
    Last edited by drewship; 01-22-2016 at 11:05 AM.

  6. #6
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Help creating search box

    If you want the matched results in column A then you're going to have to use a filter to display them as obviously formulas there are out of the question with that column being the lookup source. You can filter on the 'Row Index' column with a Custom filter >0.

  7. #7
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Help creating search box

    Maybe this is better done with VBA?

  8. #8
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Help creating search box

    DBY, I assume the 'Row Index' is column 'B' but do not know how to add a custom filter. I tried adding >0 to a couple places in
    =IF(ISNUMBER(SEARCH($D$2,A4)),ROWS(A$4:A4),"")
    but I can't get column 'A' to only display the names in the search field 'D2'.

  9. #9
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Help creating search box

    Found
    HTML Code: 
    for advanced filters but could use someone more experianced than I to implement this into my example. I tried putting a heading 'Links' in column 'E' which is where the matches currently display but the advanced filter did not recognize the generated data. I tried making column 'B' the key field by giving it a heading and making 'C3:C4' the same header and >0 but none of the data in column 'A' is being displayed unless I remove the advanced filter, probably because column 'B' is calculated.

  10. #10
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Help creating search box

    Hello
    If you select the two column headers and apply Filters, under the drop down for the Index column is an option for 'Text (or Number) Filters' where you can select 'Is Greater than'. Advanced filter will do a similar thing but you have to create a criteria range, as could VBA it's a matter of choice. VBA is the most automated. I Can supply a bit of code if it's of use, although I'm no VBA expert.
    Last edited by DBY; 01-26-2016 at 11:14 AM.

  11. #11
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Help creating search box

    I will use the search you provided for another part of the spreadsheet and will find a VBA solution to tweak this. If you have something you think can get me started it would be great. I will close this thread in a couple days. Thanks.

  12. #12
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Help creating search box

    Hi
    See the two attached files for a couple of VBA examples of how I might do this, as I said though I'm no expert, despite what my profile states. The first uses the Advanced Filter with a search/criteria cell and the second uses a search cell and the Index column with formulas to filter by >0.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Help creating search box

    Thanks DBY!! I think I like the one without the Advanced Filter since I can enter any part of the word and just press enter.

  14. #14
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Help creating search box

    Glad you found them useful. You can put a letter or part search into the advanced filter also, it should return any matches.

    *See post #16 page 2.
    Last edited by DBY; 02-01-2016 at 12:40 PM. Reason: Added note.

  15. #15
    Forum Contributor
    Join Date
    04-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    496

    Re: Help creating search box

    Not sure why but the advanced filter example only works if the search matches the words in the order of the letters in the word...so "S" would find Sam Smith...but "sm" does not find "Smith" in Sam Smith.

  16. #16
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Help creating search box

    Yes, that's true unfortunately but you can use Wildcards (*), for example

    *sm

    will show Sam Smith. See link:

    http://www.contextures.com/xladvfilter01.html#WildCard
    Last edited by DBY; 02-01-2016 at 12:13 PM.

+ 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. Creating a search box
    By 8dk5 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-26-2015, 04:24 PM
  2. [SOLVED] Creating a search
    By Aza3000 in forum Excel General
    Replies: 3
    Last Post: 08-20-2015, 09:26 AM
  3. Replies: 4
    Last Post: 05-20-2014, 10:03 AM
  4. [SOLVED] Creating a search bar using VBA
    By Steve_123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2014, 07:46 AM
  5. Creating search box in cell - Currently using Macro 'Range to search' *HELP*
    By jacko058 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2014, 05:24 AM
  6. Replies: 0
    Last Post: 03-05-2009, 01:43 PM
  7. Creating Search Bar
    By kiany406 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-28-2007, 03:21 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