+ Reply to Thread
Results 1 to 9 of 9

Combine VLOOKUP with OR Function with three options

Hybrid View

  1. #1
    Registered User
    Join Date
    12-06-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Combine VLOOKUP with OR Function with three options

    Hello! I'm frustrated because I cannot figure out how to do the following:
    I want my VLOOKUP to bring back a value if it exists; if it doesn't, look in the same table for a different combination; if that doesn't exist, look on another tab; if it doesn't exist there, bring back #N/A
    My formula is:
    =IFERROR(OR(VLOOKUP(LEFT(A2,12),'SLIN rev'!A:B,2,FALSE),VLOOKUP(A2,'SLIN rev'!A:B,2,FALSE)),VLOOKUP(LEFT(A2,12),'UB SLINs'!A:B,2,FALSE))

    It's not working....here's the breakdown of what I'm ATTEMPTING to accomplish:
    VLOOKUP(LEFT(A2,12),'SLIN rev'!A:B,2,FALSE) = Lookup against this cell through 12 characters
    IF it doesn't exist
    VLOOKUP(A2,'SLIN rev'!A:B,2,FALSE)) = Lookup against this cell through the entire character field
    If it doesn't exist
    VLOOKUP(LEFT(A2,12),'UB SLINs'!$A:B,2,FALSE) = Lookup against a different tab (UB SLINs) and bring that value back

    Any help would be greatly appreciated

    EDIT:
    I've attached a spreadsheet example
    Attached Files Attached Files
    Last edited by kibbles; 05-19-2020 at 02:19 PM.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Combine VLOOKUP with OR Function with three options

    HOW TO ATTACH YOUR SAMPLE WORKBOOK:

    Fast answers need clear examples. Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. Just before posting, scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    12-06-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Combine VLOOKUP with OR Function with three options

    I've edited my post to show an example.
    Hopefully it helps

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,739

    Re: Combine VLOOKUP with OR Function with three options

    How about
    =IFERROR(VLOOKUP(LEFT(A2,12),'SLIN rev'!A:B,2,FALSE),IFERROR(VLOOKUP(A2,'SLIN rev'!A:B,2,FALSE),VLOOKUP(LEFT(A2,12),'UB SLINs'!A:B,2,FALSE)))

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Combine VLOOKUP with OR Function with three options

    See the attached file.

    B2 =IFNA(VLookup($A2,'SLIN rev'!$A$1:$B$5,2,0),IFNA(VLookup(LEFT($A2,12),'SLIN rev'!$A$1:$B$5,2,0),VLookup(Left(A2,12),'UB SLINs'!$A$1:$B$3,2,0))) and drag down.
    Last edited by oeldere; 05-19-2020 at 02:42 PM. Reason: Dutch formula deleted

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,645

    Re: Combine VLOOKUP with OR Function with three options

    Like this:

    =IFERROR(VLOOKUP(A2&"*",'SLIN rev'!A:B,2,FALSE),VLOOKUP(A2&"*",'UB SLINs'!A:B,2,FALSE))
    Quang PT

  7. #7
    Registered User
    Join Date
    12-06-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Combine VLOOKUP with OR Function with three options

    Quote Originally Posted by oeldere View Post
    See the attached file.

    B2 =IFNA(VLookup($A2,'SLIN rev'!$A$1:$B$5,2,0),IFNA(VLookup(LEFT($A2,12),'SLIN rev'!$A$1:$B$5,2,0),VLookup(Left(A2,12),'UB SLINs'!$A$1:$B$3,2,0))) and drag down.
    Quote Originally Posted by bebo021999 View Post
    Like this:

    =IFERROR(VLOOKUP(A2&"*",'SLIN rev'!A:B,2,FALSE),VLOOKUP(A2&"*",'UB SLINs'!A:B,2,FALSE))
    Quote Originally Posted by Fluff13 View Post
    How about
    =IFERROR(VLOOKUP(LEFT(A2,12),'SLIN rev'!A:B,2,FALSE),IFERROR(VLOOKUP(A2,'SLIN rev'!A:B,2,FALSE),VLOOKUP(LEFT(A2,12),'UB SLINs'!A:B,2,FALSE)))
    You guys are awesome! It works!! Thanks!!!

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,371

    Re: Combine VLOOKUP with OR Function with three options

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,739

    Re: Combine VLOOKUP with OR Function with three options

    You're welcome & thanks for the feedback.

+ 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. [SOLVED] Combine VLOOKUP and IF Function
    By dwisetyo in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-17-2017, 12:53 PM
  2. How do i combine a vlookup function with a countif function?
    By charris58 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-08-2016, 06:15 PM
  3. [SOLVED] how to combine vlookup with ifcount function
    By rizwan32 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-24-2014, 01:49 PM
  4. [SOLVED] Combine Vlookup and Sumif function
    By HaroonSid in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-24-2014, 01:14 AM
  5. [SOLVED] Writing code for a function to combine iferror and vlookup
    By tommyko in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-31-2012, 05:39 PM
  6. How do I combine If and VLookup function?
    By Felicia Pickett in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-13-2005, 08:10 PM
  7. How to combine a vlookup with a sumif function!!!
    By Mark the Shark in forum Excel General
    Replies: 2
    Last Post: 04-06-2005, 07:06 AM

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