+ Reply to Thread
Results 1 to 8 of 8

Using VLOOKUP inside IFNUMBER(Search) to extract text in cell to lookup

  1. #1
    Registered User
    Join Date
    01-10-2016
    Location
    Colorado, USA
    MS-Off Ver
    2016
    Posts
    4

    Using VLOOKUP inside IFNUMBER(Search) to extract text in cell to lookup

    Here is what I'm trying to do:

    I want to search the text in Cell A1 for any of the items in the Lookup table column A30 through A100 and return the value from Vlookup table Column B30-B100 in B1. I have a lot of possible variables, so naming them specifically in the formula will not work due to limited about of characters allowed in cell formula.

    Here are three examples of how it should look based on what is entered in A1:
    A1= TOY_STORAGE_RM_HI_EXAMPLE B1=ROOM
    A1= THE DR IS OPEN B1= DOOR
    A1= THE DB IS ERRATIC B1= DEBOUNCE


    VLOOKUP TABLE IS A30:B100

    A30= RM B30=ROOM
    A31= DR B31=DOOR
    A32= DB B32=Debounce
    A33 through B100 will be a whole list of key words to search for in A1

    I was trying to use something like ISNUMBER(SEARCH(VLOOKUP(A1,A:30:B:100,2),A1)) in my formula but it only results in "FALSE"

    ANY ideas how to make this work?

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Using VLOOKUP inside IFNUMBER(Search) to extract text in cell to lookup

    Is it possible/probable that you'll have more than one matched item?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Using VLOOKUP inside IFNUMBER(Search) to extract text in cell to lookup

    Can your list A30:A100 eliminate false "positives" ... ex. A1= "smoke alaRM not working", "DRain clogged" so that B1 doesn't return ROOM or DOOR. If so see if this formula is something you can work with.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by FlameRetired; 01-10-2016 at 11:22 PM. Reason: clarity
    Dave

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Using VLOOKUP inside IFNUMBER(Search) to extract text in cell to lookup

    An after thought. Change the formula above to "standardize" the term in A1 like this
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Then in A30:A100 have the search terms all with a leading and trailing "_" underscore.

    See the attached. Rows 5:26 are hidden.

  5. #5
    Registered User
    Join Date
    01-10-2016
    Location
    Colorado, USA
    MS-Off Ver
    2016
    Posts
    4

    Re: Using VLOOKUP inside IFNUMBER(Search) to extract text in cell to lookup

    I'm setting it up soy that they will be unique.
    Quote Originally Posted by Ron Coderre View Post
    Is it possible/probable that you'll have more than one matched item?

  6. #6
    Registered User
    Join Date
    01-10-2016
    Location
    Colorado, USA
    MS-Off Ver
    2016
    Posts
    4

    Re: Using VLOOKUP inside IFNUMBER(Search) to extract text in cell to lookup

    Quote Originally Posted by FlameRetired View Post
    An after thought. Change the formula above to "standardize" the term in A1 like this
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Then in A30:A100 have the search terms all with a leading and trailing "_" underscore.

    See the attached. Rows 5:26 are hidden.
    Almost Perfect. I put it in an IFERROR and now it is perfect. There are possibilities where I may not have a value it can find, so I will have it leave the cell blank.
    Here is what it looks like now:

    =IFERROR(LOOKUP(2,1/(ISNUMBER(FIND($A$30:$A$100,SUBSTITUTE(A1," ","_")))*($A$30:$A$100<>"")),$B$30:$B$100),"")

    Thank you! and everyone else for your suggestions. It's great having so many knowledgeable people to support each other.

  7. #7
    Registered User
    Join Date
    01-10-2016
    Location
    Colorado, USA
    MS-Off Ver
    2016
    Posts
    4

    Re: Using VLOOKUP inside IFNUMBER(Search) to extract text in cell to lookup

    Why the number 2 in the Lookup_Value? I played around with it and it seems as long as the number is any whole number greater than zero, it works?

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Using VLOOKUP inside IFNUMBER(Search) to extract text in cell to lookup

    Very observant.

    That is nearly correct. Since the 1/array returns #DIV/0 errors and numbers no greater than 1, 2 has become sort of "standard". It works and also serves to alert the user what is likely coming next while returning the position of the last 1 in the array.

    Now using the large numbers like 25^25, 1E306 100^100 are usually used for other purposes like where the array is going to contain numbers of large and unknown value and you need an arbitrarily large number to cover all possibilities and guarantee that LOOKUP will return the position of the last row / column in the array. That is not the case here. 2 is sufficient.

    Now I said nearly because you are able to get away with using 1 because in your case there is expected to be and likely is only one 1 in the array. If you used 1 in the first argument of LOOKUP testing it against an array of multiple 1s you get very strange results. I seem to recall that it returns the position of the "middle" 1 in the array. The "middle" is vague; different for an odd number of 1s than an even. So the value of using 1 is .... I can't think of one.
    Last edited by FlameRetired; 01-11-2016 at 03:05 AM.

+ 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. Vlookup; lookup cell contains multiple strings to search for
    By jamie1985 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-17-2014, 03:43 AM
  2. VBA: Search text and extract hyperlink in same cell
    By sroysroy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2013, 11:59 AM
  3. VBA: Search text and extract hyperlink in same cell
    By sroysroy in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-24-2013, 08:55 PM
  4. How to search a text inside the textbox
    By azid_miracle in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-04-2012, 08:20 AM
  5. Can I extract certain words from inside a cell?
    By kufta4 in forum Excel General
    Replies: 4
    Last Post: 03-30-2011, 11:01 AM
  6. Replies: 2
    Last Post: 06-14-2010, 03:28 PM
  7. Search text inside a string
    By pimar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2006, 01:01 PM

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