+ Reply to Thread
Results 1 to 13 of 13

Iferror with multiple vlookups

  1. #1
    Registered User
    Join Date
    02-09-2016
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2007
    Posts
    20

    Iferror with multiple vlookups

    If you look at the attachment, there are 3 tabs (Active Contracts, Monthly Sales by PLI and US_CA Price List).

    I am looking for a formula for I2, L2 and O2 on the Active Contracts tab.

    Right now I have the following in I2 -> =IFERROR(VLOOKUP(C2,'Monthly Sales by PLI'!N:O,2,0),0%)

    Basically giving me the average discount for a specific Price List (off Monthly Sales by PLI) by product group.

    I realize that this average is not always the best representation....especially when there is no sales activity.

    So, I want a formula that will find the average in Monthly Sales by PLI....and should that average discount be a 0...then I want to VLOOKUP to the US_CA Price List to see if there is a match such as -> =IF(E2='Canada",IFERROR(VLOOKUP(102320&$C2,'US_CA 2016 Price List'!Y:AH,10,0),0 ),IFERROR(VLOOKUP(102320&$C2,'US_CA 2016 Price List'!N:W,10,0),0))

    So 1st check Monthly Sales by PLI, if 0% discount, then check US_CA Price List.

    http://www.excelforum.com/newthread....=newthread&f=4
    Attached Files Attached Files
    Last edited by SanchoPanza1; 05-09-2016 at 08:48 PM. Reason: New Attachment

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Iferror with multiple vlookups

    Monthly Sales by PLI'!N:O
    theres no data in N to O on that sheet

    you are looking up the price list ID from sheet "active"
    then using the value found in C2 "Price List ID" to then lookup an average figure from the "Monthly Sales by PLI" sheet

    in Column A you have a heading
    "Average of Discount" - which has the same iD as "Price List ID" is that the column you want to use to lookup and return another value from ?
    if so which row should be used ?

    in the US_CA Price List
    you have a header in column B PRICE_LIST_ID and also in M
    which do you want to use

    because your example for a vlookup has
    US_CA 2016 Price List'!Y:AH
    and again there is no data in Y:AH

    you can setup an IF to lookup if there is novalue or if its zero using an OR ( ISERROR(vlookup), vlookup = 0)
    and if TRUE , then you can lookup the CA value

    IF( OR ( ISERROR(vlookup-Monthly Sales by PLI), vlookup-Monthly Sales by PLI = 0), VLOOKUP-US_CA 2016 Price List, vlookup-Monthly Sales by PLI) )

    what happens if CA is also a zero ?
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    02-09-2016
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Iferror with multiple vlookups

    Monthly Sales by PLI'!N:O
    theres no data in N to O on that sheet -> My apologies. I shifted data around. Main concern on this sheet are columns A thru D.

    you are looking up the price list ID from sheet "active"
    then using the value found in C2 "Price List ID" to then lookup an average figure from the "Monthly Sales by PLI" sheet ->Yes that is correct. This is the 1st vlookup. If there is a zero value on the search then we need to vlookup on the "US_CA 2016 Price List"

    in Column A you have a heading
    "Average of Discount" - which has the same iD as "Price List ID" is that the column you want to use to lookup and return another value from ?
    if so which row should be used ?-> Correct. It will all depend on the product we are looking for an average discount on. I2 we will search in column B in "Monthly Sales by PLI". L2 we will search in column D in "Monthly Sales by PLI". And, O2 we will search in column C in "Monthly Sales by PLI". All pertaining to Price List ID.

    in the US_CA Price List
    you have a header in column B PRICE_LIST_ID and also in M
    which do you want to use -> This is my second VLOOKUP Search parameter. If we find a "0" for that 1st search on the "Monthly Sales by PLI" & E2 on the "Active" sheet reads as Canada....then we want to search columns M thru U on "US_CA Price List". If we find a "0" for that 1st search on the "Monthly Sales by PLI" & anything other then Canada on E2 on "active...then columns B thru J on "US_CA Price List".

    because your example for a vlookup has
    US_CA 2016 Price List'!Y:AH
    and again there is no data in Y:AH -> My apologies. I deleted data for security purposes. Se my comments above.

    I essentially want to do as follows (example):
    Step 1: =IFERROR(VLOOKUP(I14,'Monthly Sales by PLI'!N:O,2,0),0%)
    If above equals 0%,
    Step 2: =IF(M2="Canada",IFERROR(VLOOKUP(102320&$I2,'CA Price List Discount'!$A:$J,10,0),0),IFERROR(VLOOKUP(102320&$I2,'US Price List Discount'!$A:$J,10,0),0))
    Note: numbers 102320 & 102320 serve merely as identifier (internal use). For purposes of simplicity, I would use Price List ID as the match for VLOOKUP purposes

  4. #4
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Iferror with multiple vlookups

    can you attach another example with the correct layout and data
    and range and ID - its very confusing otherwise ..

    But I will try to work something out

    in I2
    VLOOKUP(I14,'Monthly Sales by PLI'!A:B,2,0)
    If this returns a zero then we use canada
    What if the lookup returns an error - because the Id cannot be found ?
    IF( OR ( iserror(VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0)), VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0)=0),
    so if the result is a zero or an error use the canada sheet

    IF( OR ( iserror(VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0)), VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0)=0), VLOOKUP(c2,'CA Price List Discount'!$A:$J,10,0), VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0))
    if canada pruduces an error then we need to allow for that and set to zero
    IFERROR ( IF( OR ( iserror(VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0)), VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0)=0), VLOOKUP(c2,'CA Price List Discount'!$A:$J,10,0), VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0)), 0)

    we now need to add the canada value

    Again a little confused when to apply this -


    The ranges are all incorrect
    if you setout a sample with the correct ranges and data I can help further
    and perhaps the order of the rules and ranges


    you say
    This is my second VLOOKUP Search parameter. If we find a "0" for that 1st search on the "Monthly Sales by PLI" & E2 on the "Active" sheet reads as Canada....then we want to search columns M thru U on "US_CA Price List". If we find a "0" for that 1st search on the "Monthly Sales by PLI" & anything other then Canada on E2 on "active...then columns B thru J on "US_CA Price List".
    IFERROR ( IF( OR ( iserror(VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0)), VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0)=0), VLOOKUP(c2,'CA Price List Discount'!$A:$J,10,0), VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0)), 0)

    AND( OR ( iserror(VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0)), VLOOKUP(C2,'Monthly Sales by PLI'!A:B,2,0)=0), E2="Canada")

  5. #5
    Registered User
    Join Date
    02-09-2016
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Iferror with multiple vlookups

    Thank you for your patience. I have attached a new excel with the correct layout, range, notes, etc.

  6. #6
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Iferror with multiple vlookups

    Thanks unfortunately the pc I have with me has broken so probably be weekend before I pickup my w7 pc sorry about that
    The spare one I have does not have office

  7. #7
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Iferror with multiple vlookups

    why are you looking in A/B on Monthly Sales by PLI
    if they are always going to be blank/zero
    and so look up a different sheet
    Need to find a formula here that searches in "Monthly Sales by PLI" sheet by Price List ID (A2=> 354133)
    VLOOKUP will only include columns A thru B on "Monthly Sales by PLI" sheet as we are only concerned with Alloderm product average discount
    If you notice on the "Monthly Sales by PLI" sheet, there is no discount for this product line
    Because there is a blank or "0" for this particular Price List ID (354133 on Alloderm/AD), I now want to do an additional check on the "US_CA 2016 Price List" sheet
    On this additional VLOOKUP, I want to check to see if "Canada" appears in D2
    In this case it does not, so we would VLOOKUP to columns A thru J on the "US_CA 2016 Price List" sheet

  8. #8
    Registered User
    Join Date
    02-09-2016
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2007
    Posts
    20
    Quote Originally Posted by etaf View Post
    why are you looking in A/B on Monthly Sales by PLI
    if they are always going to be blank/zero
    and so look up a different sheet
    That will not always be the case. The revised excel attachment only has a sample of the price lists that I am searching for. In most cases, there will be an average discount on the Monthly Sales by PLI.
    I would like to arrive at a full proof check to get rid of all zero values.

  9. #9
    Registered User
    Join Date
    02-09-2016
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Iferror with multiple vlookups

    I have attached another version of the excel with more data & some Q&A section.
    Please note that this excel is a sample of a bigger data set.
    Your help is very much appreciated.

  10. #10
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Iferror with multiple vlookups

    Ignorring any lookup errors on the sheet and #N/A being returned
    this should work
    =IF(VLOOKUP(A2,'Monthly Sales by PLI'!A:B,2,FALSE)=0,IF(C2="canada",VLOOKUP(A2,'US_CA 2016 Price List'!M:U,9,FALSE),VLOOKUP(A2,'US_CA 2016 Price List'!B:J,9,FALSE)),VLOOKUP(A2,'Monthly Sales by PLI'!A:B,2,FALSE))

    Can you just check that the formula works as you expect - BUT ignore any errors returned - we can correct that later

    just want to make sure the basic formula does actually work

    if it does - we can add error correction
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    02-09-2016
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Iferror with multiple vlookups

    The formula does get closer to a finished product, but as you mention there are errors.
    Last edited by SanchoPanza1; 05-11-2016 at 08:16 PM.

  12. #12
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Iferror with multiple vlookups

    i would edit and remove your email address - thats the quickest way to get spam

    if its correct , ignoring errors , then we can setup an error correction

    if step1 lookup on PL sheet produces and error then we can use the Canada/non Canada range -
    But if that produces an error - what result do you want ?

  13. #13
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Iferror with multiple vlookups

    i have had to use a helper column for the vlookups to see if ther is an error
    iserror()
    and then test for true OR 0 on the first sheet before going off to canada

+ 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] iferror with multiple vlookups
    By SanchoPanza1 in forum Excel General
    Replies: 2
    Last Post: 04-27-2016, 08:02 PM
  2. [SOLVED] Multiple IFERROR or IFERROR w/ If Statements
    By SanchoPanza1 in forum Excel General
    Replies: 4
    Last Post: 03-31-2016, 08:09 PM
  3. [SOLVED] IFERROR(MATCH & IFERROR(SMALL Help Needed
    By chad328 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 01-17-2016, 06:34 AM
  4. xlfn.IFERROR or IFERROR don't work in Excel 98-2003
    By dj_danu01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2013, 02:53 AM
  5. VLOOKUPS in multiple closed workbooks with multiple tabs
    By exclusivelyexcel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-23-2011, 03:33 PM
  6. multiple Vlookups?
    By GrantShoe in forum Excel General
    Replies: 5
    Last Post: 10-14-2008, 07:41 AM
  7. Sum a row of multiple vlookups
    By jtgostars in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-10-2005, 02:40 PM

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