+ Reply to Thread
Results 1 to 5 of 5

Nested IF with VLOOKUP #2

  1. #1
    Registered User
    Join Date
    09-21-2009
    Location
    AZ
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    12

    Question Nested IF with VLOOKUP #2

    This is what I have:

    =SUMIF(Profit!D:D,VLOOKUP(Profit!D2,SlotCodes!A:C,3)={1,3},Profit!E:E)

    And it doesn't work! What is wrong?

    This is what I want it to do:

    Worksheets involved: Forecast, Profit, SlotCodes

    On Forecast, lookup the code (either 2 letters or 2 numbers) in column D on Profit. Match that code in column A on SlotCodes. Lookup answer is in column C (possible choices, 1,2,3,4).

    Take that answer, and if it is a 1 or 3, then sum the cooresponding column E on Profit.

    So, the sum of column E on Profit that coorespondes to a 1 or 3 needs to go in cell B2 on the Forecast worksheet.

    Does that make sense?

    Thanks.

    Alisa

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Nested IF with VLOOKUP #2

    Hello Alisa,

    Try using an array formula like this

    =SUM(IF(ISNUMBER(MATCH(Profit!D2:D100,IF((SlotCodes!C2:C10=1)+(SlotCodes!C2:C10=3),SlotCodes!A2:A10,""),0)),E2:E100))

    confirmed with CTRL+SHIFT+ENTER

    extend ranges as necessary but you can't use whole columns

  3. #3
    Registered User
    Join Date
    09-21-2009
    Location
    AZ
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    12

    Re: Nested IF with VLOOKUP #2

    I got a zero for an answer using that formula

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Nested IF with VLOOKUP #2

    Oh! I missed the sheet name of the last range so it should be

    =SUM(IF(ISNUMBER(MATCH(Profit!D2:D100,IF((SlotCodes!C2:C10=1)+(SlotCodes!C2:C10= 3),SlotCodes!A2:A10,""),0)),Profit!E2:E100))

    Make sure you use CTRL+SHIFT+ENTER so that curly braces appaer around the formula.....

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Nested IF with VLOOKUP #2

    Another alternative perhaps would be to store the SlotCode result in a spare column on Profit sheet. Assume for sake of demo Col F on Profit sheet is spare, then:

    Please Login or Register  to view this content.
    Then your Forecast formula becomes

    Please Login or Register  to view this content.

+ 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