+ Reply to Thread
Results 1 to 7 of 7

VLookup + If condition

  1. #1
    Registered User
    Join Date
    07-06-2013
    Location
    United States
    MS-Off Ver
    Office365
    Posts
    7

    VLookup + If condition

    I am trying to figure out a formula that I don't believe is too complex, I just can't resolve it. Here is a very simplified version of my table to give you the general idea.

    Item Event Date
    A100 Ordered 07/01/2013
    A100 Shipped 07/03/2013
    B101 Ordered 06/23/2013
    B101 Shipped 06/24/2013
    C100 Ordered 07/15/2013
    C100 Shipped 07/20/2013

    I want to look up the Order Date for anything shipped and put that date in col 4.

  2. #2
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Re: VLookup + If condition

    Try this
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    make sure the cells with this formula are formatted to be Date
    Don't just use the answers provided for you. Try to understand how it works by reverse engineering or asking about it.

    Please mark the thread as [SOLVED] (Thread Tools->Mark thread as Solved) when answered.
    If you're happy with an answer given, please click the * under the person's name to boost their reputation.

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: VLookup + If condition

    Give a try to this ARRAY formula.

    =IFERROR(INDEX($C$2:$C$10,SMALL(IF($B$2:$B$10="Shipped",ROW($B$2:$B$10)-1),ROW(C1))),"")



    -- Array(CSE) { }, formulae are confirmed with Control+Shift+Enter.
    Not just Enter.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Registered User
    Join Date
    07-06-2013
    Location
    United States
    MS-Off Ver
    Office365
    Posts
    7

    Re: VLookup + If condition

    =IF(B3="ordered","",SUMPRODUCT((A:A=A3)*(B:B="ordered"),C:C)) produces the following.
    Item Event Date
    A100 Ordered 7/1/2013 7/1/2013
    A100 Shipped 7/3/2013
    B101 Ordered 6/23/2013 6/23/2013
    B101 Shipped 6/24/2013
    C100 Ordered 7/15/2013 7/15/2013
    C100 Shipped 7/20/2013 1/0/1900

    =IFERROR(INDEX($C$2:$C$10,SMALL(IF($B$2:$B$10="Shipped",ROW($B$2:$B$10)-1),ROW(C1))),"") produces the following:

    Item Event Date
    A100 Ordered 7/1/2013 7/3/2013
    A100 Shipped 7/3/2013 6/24/2013
    B101 Ordered 6/23/2013 7/20/2013
    B101 Shipped 6/24/2013
    C100 Ordered 7/15/2013
    c100 Shipped 7/20/2013

    What I am trying to produce is this:

    Item Event Date Ordered
    A100 Ordered 7/1/2013
    A100 Shipped 7/3/2013 7/1/2013
    B101 Ordered 6/23/2013
    B101 Shipped 6/24/2013 6/23/2013
    C100 Ordered 7/15/2013
    c100 Shipped 7/20/2013 7/15/2013

  5. #5
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Re: VLookup + If condition

    My equation if you started in cell D3 and copied down should provide you with the Solution you were looking for.

    Can you upload your copy of the workbook with our equations put in?

  6. #6
    Registered User
    Join Date
    07-06-2013
    Location
    United States
    MS-Off Ver
    Office365
    Posts
    7

    Re: VLookup + If condition

    It works if there is only 1 product ID with Ordered and 1 Shipped. But if the same product number was ordered and shipped twice, then I run into the formula not working. Test file attached.
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Re: VLookup + If condition

    Unless you have another field that is a unique identifier for each order (not just the item#), there's no way that I know of to get what you want. If the orders are always grouped together ("ordered" record directly above the "shipped" record) you can just set the equation to equal the cell above.

+ 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] VLOOKUP with condition
    By [email protected] in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-01-2012, 02:33 AM
  2. VLOOKUP and IF condition
    By Fatherjawn in forum Excel General
    Replies: 3
    Last Post: 06-18-2012, 06:17 AM
  3. Vlookup with a condition
    By conphara in forum Excel General
    Replies: 1
    Last Post: 08-13-2011, 11:17 AM
  4. Vlookup on a condition
    By manny_cb in forum Excel General
    Replies: 2
    Last Post: 06-20-2008, 11:30 AM
  5. Replies: 1
    Last Post: 11-23-2005, 12:00 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