+ Reply to Thread
Results 1 to 5 of 5

Vlookup Part of Cell

  1. #1
    Forum Contributor
    Join Date
    02-10-2007
    MS-Off Ver
    Excel 2010
    Posts
    293

    Vlookup Part of Cell

    Hello,

    I am trying to compare two sets of data on two different tabs.

    Comparing tabs, GA vs Puburl

    On tab puburl, the list contains data such as:

    http://www.abcdef.com/dasfsdf/index.html
    http://www.alllittirs.com

    I want to compare this against the data in tab Ga, which contains data such as:

    Source Numbers Euros
    alllittirs.com 23973 454
    defghi.com 7725 212


    The end result should be in tab puburl:, to display the numbers and euros such as in example of spreadsheet attached.

    If it doesn't find the matching result to display blank.

    Basically, if the cell contains http://www. or anything preceding site.com, it should match.

    I tried, =IF(ISNA(VLOOKUP("*"&GA!A2&"*",PUBURL!$A$2:$C$6,2,FALSE)),"",VLOOKUP("*"&GA!A2&"*",PUBURL!$A$2:$C$6,2,FALSE)) but that didnt give desired result, in pub url tab for cell b2 and copied down.
    Attached Files Attached Files

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Vlookup Part of Cell

    Try:

    =IF(ISNA(LOOKUP(2,1/ISNUMBER(SEARCH(GA!$A$2:$A$10,$A2)),GA!B$2:B$10)),"",LOOKUP(2,1/ISNUMBER(SEARCH(GA!$A$2:$A$10,$A2)),GA!B$2:B$10))

    copied down and over to next column

    adjust ranges to suit.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    02-10-2007
    MS-Off Ver
    Excel 2010
    Posts
    293

    Re: Vlookup Part of Cell

    Thanks NBVC. Works Perfectly. Though I'm having a hard time understanding it. Here's how I'm interpreting it:

    1. (SEARCH(GA!$A$2:$A$10,$A2)),GA!B$2:B$10)) It searches for GA!$A$2:$A$10,$A2, within $A2

    2. If Then it performs 1/ISNUMBER Function, Checking for True/False. If it does not find (false) it equates to (1/False), but the isnumber function "cancels" the Div 0 error out

    3. It the Result from 1/ISNUMBER Function is True, it then Looksup on GA!B$2:B$10

    4. And Then Does Lookup value (2). ---- I have no idea what the Lookup(2) does, why did you do this?

    5. Finally it performs ISNA Function. If everything inside (LOOKUP(2,1/ISNUMBER(SEARCH(GA!$A$2:$A$10,$A2)),GA!B$2:B$10) is False, it puts "", else it performs (LOOKUP(2,1/ISNUMBER(SEARCH(GA!$A$2:$A$10,$A2)),GA!B$2:B$10)


    is this the correct interpretation?

    Finally, is there a way to do something similar to =IF(ISNA(VLOOKUP("*"&GA!A2&"*",PUBURL!$A$2:$C$6,2,FALSE)),"",VLOOKUP("*"&GA!A2&"*",PUBURL!$A$2:$C$6, 2,FALSE)), basically using a simple vlookup with * ?

  4. #4
    Forum Contributor
    Join Date
    02-10-2007
    MS-Off Ver
    Excel 2010
    Posts
    293

    Re: Vlookup Part of Cell

    bumping up, anyone?

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Vlookup Part of Cell

    SEARCH(GA!$A$2:$A$10,$A2) searches A2 for any of the text strings within GA!$A$2:$A$10

    ISNUMBER(SEARCH(GA!$A$2:$A$10,$A2)) returns TRUE for all items in GA!$A$2:$A$10 found in $A2 and FALSE for those not found... it returns an array...

    1/ISNUMBER(SEARCH(GA!$A$2:$A$10,$A2)) returns 1's and #DIV/0 errors based on result of 1/TRUE or 1/FALSE results in the array (where TRUE is equivalent to 1 and FALSE is equivalent to 0).

    LOOKUP(2,1/ISNUMBER(SEARCH(GA!$A$2:$A$10,$A2)),GA!B$2:B$10) looks for a 2 in the array of 1's and #DIV/0 errors and finds the last time the item is smaller than or equal to 2.. ignoring #DIV/0 errors... which in your case should be the last time and only time.. since there is one match... and then it returns the corresponding item in GA!B$2:B$10.

    The IF(ISNA()) part looks to see if no results match.. i.e. if the LOOKUP() formula finds no matches, then #N/A is returned... if that is the case, then a null is returned, if not, then it re-evaluates the LOOKUP() function and returns a result.

    Review each function in EXCEL help files for more details on the basic functionality of each.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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