+ Reply to Thread
Results 1 to 13 of 13

How do I use VLookup with an OR/AND statement or Nested IFs

  1. #1
    Registered User
    Join Date
    04-02-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    How do I use VLookup with an OR/AND statement or Nested IFs

    Hello,

    I have an issue I can't seem to figure out

    Question: How do I combine multiple VLookups in 3 datasets into into one formula. I will like to be able to select an option in a given drop down list, it will compare different worksheets and populate data relevant to what has been selected:

    Individually the below formulas work and pull the relevant data from the relevant cell, but I need to be able to put them all in one cell (one formula).

    Once Group_1 set of formula are run the relevant data in Group_2 is pulled into the right column.

    Group_1
    =IF(ISERROR(VLOOKUP(L10,StdardCTRLREF,11,FALSE)),"",VLOOKUP(L10,StdardCTRLREF,11,FALSE))
    =IF(ISERROR(VLOOKUP(L10,LclCTRLREF,11,FALSE)),"",VLOOKUP(L10,LclCTRLREF,11,FALSE))
    =IF(ISERROR(VLOOKUP(L10,Generic,11,FALSE)),"",VLOOKUP(L10,Generic,11,FALSE))


    Group_2
    =IF($M10="Key",VLOOKUP($L10,StdardCTRLREF,5,FALSE),0)
    =IF($M10="Key",VLOOKUP($L10,LclCTRLREF,5,FALSE),0)
    =IF($M10="Key",VLOOKUP($L10,Generic,5,FALSE),0)


    Any suggestion to achieve this is most welcome.

    Thank you

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: How do I use VLookup with an OR/AND statement or Nested IFs

    Please attach a sample workbook. Make sure there is enough data to demonstrate your need. Make sure your desired results are shown, mock them up manually if necessary. Remember to remove ALL confidential information first!!!

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    The paperclip icon
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    04-02-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How do I use VLookup with an OR/AND statement or Nested IFs

    Thank you for your response Glenn, Please see requested info attached:

    Worksheet related information

    My issue is focused in the R2R worksheet What I am trying to achieve is as below:
    • When I select an option from column L10 onwards dropdown list:
    • This will update the related Key control(Column M) from the necessary database
    • This will also update columns E-J


    However I am able to only get this to work presently if the formula is to only one specific dataset/database not all 3

    I will like to be able to select the data from the dropdown list in Column L (row 10 onwards) which will then populate then populate the respective columns E-J and M based on the appropriate database.

    Data in the dropdown list in column L are outlined in the datasets
    StandardControlRef - Standaards database
    LocalControlRef - Local Databse
    Generic - Generic Database

    Please let me know if you need any additional information.

    Thank you
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: How do I use VLookup with an OR/AND statement or Nested IFs

    I've had a look at this - and the structure of your sheet is (slowly!!) beginning to make sense to me!! You do seem to have a lot of inoperative named ranges in play, though!!

    If I read you correctly, If I select a C-FM number in a cell in L; you want a lookup ferformed on ALL THREE sheets (standard, local and generic) and have the result(s) shown in M. is that correct? In the case of C-FM2720 there are 2 values that will be returned: "key" and "key". How would you like that to be displayed? Just as a single answer: "key" or something like
    Standard: nil
    Local: Key
    Generic: Key

    all in a single cell, or what?????

  5. #5
    Registered User
    Join Date
    04-02-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How do I use VLookup with an OR/AND statement or Nested IFs

    The workbook contains quite a few other sheets which I deleted before sharing, I have however shared additional sheets as they are identical to the R2R worksheet. Those inoperative named ranges come into play in those sheets.

    I have attached an image explaining the below

    Yes if you select C-FM2740(Standard control database) in cell L10; M10 returns the corresponding value in this case, 'Key', while E10 - J10 return respective values from their respective name range in this case StandardControlRef

    if you select C-FM2785(LocalControl database) in cell L11; M11 returns the corresponding value in this case, 'Supporting', while E10 - J10 return values from LocalControlRef

    if you select C-FM2720(Generic control database) in cell L12; M12 returns the corresponding value in this case, 'Key', while E - J return values from GenericControlRef

    There won't be an option for Null except where 'spare row' is selected

    Column L - pulls it's data from R2R (A108 Onwards)

    With regards to duplicate values, I will be working on a formula to ensure there are no duplicate values in the control name column of the 3 database sheets, Also column L will only pull data from the R2R sheet A108 onwards..

    A108 onwards is however completed by selecting data from respective name ranges in the database sheets.

    I managed to get this formula to pull data but there is still an error in it:
    =IF(ISERROR(VLOOKUP(M10,StandardCONTROLREF,12,FALSE)),IF(ISERROR(VLOOKUP(M10,GenericCONTROLREF,12,FALSE)),IF(ISERROR(VLOOKUP(M10,LocalCONTROLREF,12,FALSE)),"",VLOOKUP(M10,LocalCONTROLREF,12,FALSE)),VLOOKUP(M10,GenericCONTROLREF,12,FALSE)),VLOOKUP(M10,StandardCONTROLREF,12,FALSE))


    Please let me know if you have any further questions
    Attached Images Attached Images
    Attached Files Attached Files

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: How do I use VLookup with an OR/AND statement or Nested IFs

    Ho hum. I went down one road first of all, adding an extra column to specify the control type (standard, local or generic) and then used a combination of LOOKUP and INDIRECT to send Excel off to the right sheet (One way.xls).

    i then (rather late in the process) noticed that you said that there wouldn't be any duplicate values, so I nested your formula. Since you are using Excel 2003, the formula is a bit longer than it would be in 2007+. Basically: lookup standardcontrol ref. If error, look up localcontrolref. If error, lookup generic control ref.

    Is that what you wanted??
    Attached Files Attached Files

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: How do I use VLookup with an OR/AND statement or Nested IFs

    Please explain something!!!

    Your profile says Excel 2003. You attached an xlsx file (2007+) and have used formulae that don't work in Excel 2003. You used a cumbersome error trapping formula that fell into disuse when 2007 came along. So which version of Excel are you using????

  8. #8
    Registered User
    Join Date
    04-02-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How do I use VLookup with an OR/AND statement or Nested IFs

    Hi Glenn,

    Sorry I create my profile back in 2009 when I was working with Office 2003 and I haven't updated it since. I now use 2010 hence the xlsx file, I will update the profile to reflect this. I apologise if that was misleading.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: How do I use VLookup with an OR/AND statement or Nested IFs

    OK, thanks. Can you see if the solution that was offered does what you want it to do. If it's OK, I'll update the formula to 2010..

  10. #10
    Registered User
    Join Date
    04-02-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How do I use VLookup with an OR/AND statement or Nested IFs

    Yes thank you!!! .
    I believe the workbook with the title "one way" is a cleaner approach.

    I was trying to adapt it for cells E10 - J10, but found a flaw in my formula which is, if the value is not "Key", it fails to populate the table, but the value can be key or supporting (which is pulled from R2R K108 onwards) and it should populate the cells with the respective data from R2R rows A108 onwards

    =IF($M10="Key",VLOOKUP($L10,StandardCONTROLREF,5,FALSE),0)

    I should be using the Indirect here so the data is read from the 3 datasets and not just the specified dataset.

    Can you please assist with this?

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: How do I use VLookup with an OR/AND statement or Nested IFs

    Since you're suing 2010, the monster formula is much easier and so I decided to stick witht he no helper approach. I'm not 100% sure if I've returned what you want for the E-J columns, but do take a look.

    For E-J, drag across & down: =IFERROR(IFERROR(IFERROR(VLOOKUP($L10,StandardCONTROLREF,5,FALSE),VLOOKUP($L10,LocalCONTROLREF,5,FALSE)),VLOOKUP($L10,GenericCONTROLREF,5,FALSE)),"")

    for M, drag down:

    =IFERROR(IFERROR(IFERROR(VLOOKUP(L10,StandardCONTROLREF,11,FALSE),VLOOKUP(L10,LocalCONTROLREF,11,FALSE)),VLOOKUP(L10,GenericCONTROLREF,11,FALSE)),"")
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    04-02-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How do I use VLookup with an OR/AND statement or Nested IFs

    Thank you Glenn, this worked excellently.

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: How do I use VLookup with an OR/AND statement or Nested IFs

    Glad to have helped! If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. It'd also be appreciated if you were to click the add Reputation button at the foot of any of the posts of those who helped you reach a solution.

+ 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] Nested vlookup in an IF statement
    By adray13 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-26-2013, 09:41 AM
  2. [SOLVED] VLookup nested in If/then statement
    By Mile029 in forum Excel General
    Replies: 3
    Last Post: 08-29-2012, 11:28 AM
  3. IF statement with vlookup nested
    By libertine86 in forum Excel General
    Replies: 5
    Last Post: 08-16-2012, 02:49 PM
  4. [SOLVED] Nested If statement and Vlookup
    By bhavish524 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-20-2012, 10:42 AM
  5. nested if statement using vlookup
    By mdot218 in forum Excel General
    Replies: 2
    Last Post: 01-27-2012, 02:39 PM
  6. nested vlookup with if statement
    By maacmaac in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-19-2009, 12:08 PM
  7. If statement with nested Vlookup and Sum
    By luiscorrea in forum Excel General
    Replies: 3
    Last Post: 08-10-2007, 02:00 PM
  8. [SOLVED] Nested IF statement with VLOOKUP
    By James Hamilton in forum Excel General
    Replies: 1
    Last Post: 08-16-2006, 02:50 AM

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