+ Reply to Thread
Results 1 to 4 of 4

i want to find a value in two different sheets with one formula

  1. #1
    Registered User
    Join Date
    01-17-2009
    Location
    Torreon, Mexico
    MS-Off Ver
    Excel 2003
    Posts
    2

    Exclamation i want to find a value in two different sheets with one formula

    hi i m a new user, and i from mexico so my english is not so good...i hope you understand me... i need to know how to find a value looking for in two different sheets...this is the formula i m making...

    =if(A1=(vlookup(A1,sheet1!A:B,1,false)),vlookup(A1,sheet1!A:B,2,false),vlookup(A1,sheet2!A:B,2,false)

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

    Please Login or Register  to view this content.
    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
    Registered User
    Join Date
    01-17-2009
    Location
    Torreon, Mexico
    MS-Off Ver
    Excel 2003
    Posts
    2
    OOOOOHH my god it works EXCELLENT......thank you so much....Can you explain me the formula??? i want to know how it works...

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    When Vlookup() function does not find a match, it returns a #N/A error. So the first part of the formula checks if there is no match found in Sheet1... that's with the Isna() function (which means is the result N/A?). If it is not found (or N/A), then it will perform the 2nd part (which is to look in Sheet2), otherwise it should be in Sheet1 so it will execute the 3rd part and return that.... if both sheets have no matches, you will get the #N/A error.

    Note: there are other ways of writing the formula that may be more efficient... one of the best ways is as follows:

    =IF(ISNUMBER(MATCH(A1,Sheet1!A:A,FALSE)),VLOOKUP(A1,sheet1!A:B,2,FALSE),VLOOKUP(A1,Sheet2!A:B,2,FALSE))

    which is similar...except the Match() function returns a number representing the position of the match it finds in the range Sheet1!A:A. If it finds a match, then the ISNUMBER() validates and returns TRUE.. which forces the Vlookup in Sheet1 (ie. the 2nd part of the IF() formula. If Isnumber() returns FALSE (i.e. no match found), then it goes to the 3rd part of the formula to lookup Sheet2.

    Hope this all helps.

+ 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