+ Reply to Thread
Results 1 to 7 of 7

Vlookup – Picking up first date and then picking up second date if there is one.

  1. #1
    Registered User
    Join Date
    10-18-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Vlookup – Picking up first date and then picking up second date if there is one.

    Hi there,

    This is my first ever post but I have used the forum to look at other people’s questions – they have been a lot of help so thanks to everyone out there. However, this time, I have not been able to find an answer to my problem so I am appealing for help.

    I look after the inventory at a small company. We know how much stock we have in at any time and know roughly how many of each product we sell a week so we know when to order stock and when we will have a stock out etc. Recently, I have been building a sheet which looks at our inventory levels taking into account orders we have placed. My workbook has two sheets, one for “inventory levels” and one is “live orders”

    Every product has a unique code (ie Product 1 – Small, Product 1 – Medium, ….., Product 2 – Small, Product 2 – Medium……) On the inventory levels sheet I have columns for “Order Volume”, “Order Status” “Warehouse arrival date – SEA freight” “Warehouse arrival date – Air Freight”, the data for which comes from the “live orders” sheet using a vlookup on the product code. This all works well BUT I have a problem when there is more than one live order outstanding for the same product code ie one order for Product 1 – Medium arriving on one date and another order for Product 1 – Medium which is arriving on a second date as the vlookup just picks up the first order.

    On the inventory levels sheet I have created a “first order” section and a “second order” section. I have been searching for a way for the vlookup to put the first live order data in the First Order section under “Order Volume”, “Order Status” “Warehouse arrival date – SEA freight” “Warehouse arrival date – AIR Freight” and then IF there is a second live order then the data will go in the Second Order section.

    Then, if there are two orders and the first one is received into the warehouse there would only be one live order so the data in the "first order" section will disappear and be replaced by the data that was in the "second order" section.

    Sorry if this is not that clear – I have tried my best – but if it is not I have uploaded a file which should make it clear hopefully. As I say, if a product code only has one live order I’m fine but it all goes wrong when there is a second live order for the same thing!

    Thanks

    Cranston
    Attached Files Attached Files

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Vlookup – Picking up first date and then picking up second date if there is one.

    Cranston,

    Welcome to the forum!
    Have a look at this thread. It has an example workbook, formulas used, and a link to a site that goes into a bit more depth on this exact topic:
    http://www.excelforum.com/excel-tips...e-results.html
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    10-18-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Vlookup – Picking up first date and then picking up second date if there is one.

    Hi tigeravatar,

    Thanks so much for your quick reply and sorry for my slow response (I was away for the weekend and blissfully had no BB signal!).

    I have come into the office on Sunday night to have a look at this. I'm afraid that I have spent over 90 mins on it but can't seem to get your formula to work on my workbook. I'm reasonable at excel (I've been an accountant for 6 years) but this has proved to be beyond me. I'm also the one people in the office look to for help with excel so I won't get help from them.

    I know this is slightly cheeky (and maybe against rules - if so obviously don't do it and please let me know) but could you do the formula for the first two columns and post the formulas in there please? ie cell A has formula "BCD" and cell E had formula "FGH" in it.

    This would be such a help so if you could tigeravatar I would be hugely grateful.

    Kind regards

    Cranston

  4. #4
    Registered User
    Join Date
    10-18-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Vlookup – Picking up first date and then picking up second date if there is one.

    Or if anyone else can that would be brilliant. It should be stated that I will probably not be able to help back as I'm very much at the bottom of the excel learning curve but it would be a great help to me if you could.

  5. #5
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Vlookup – Picking up first date and then picking up second date if there is one.

    Cranston,

    I'm not generally on the forums during weekends, so I didn't see this again until today.
    Attached is a modified version of your posted workbook. Here is the generic format of the array formula that is used:
    Please Login or Register  to view this content.

    Note that array formulas must be entered with Ctrl+Shift+Enter and not just Enter. That's how it gets surrounded by the curly braces {}. Do not try to add those manually.

    The first part in red, $F:$F, is the column that will be returned by the formula. In this case we want the Order Volumn, which is column F on sheet 'Live orders'. Adjust as needed for each column (so that when it needs to return the Order Status, that $F:$F becomes $E:$E. You'll see that it has already been adjusted in the attached).

    The second part in red, the number 1, tells the formula which occurence to return. The number 1 indicates that it should return the first occurrence. For the section labelled "Second Order", the 1 should be a 2 to tell the formula to return the second occurrence (you'll see that this is also included in the attached).

  6. #6
    Registered User
    Join Date
    10-18-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Vlookup – Picking up first date and then picking up second date if there is one.

    tigeravatar,

    Thank you SO much! That works perfectly! I think I understand it too which is a great help to me and my colleagues. If I could I would be you a beer.

    This forum (and others like it) are so helpful but it seems to me that they are maybe underused and not valued nearly highly enough ie this will help my company hugely.

    Thanks again!

    Cranston

  7. #7
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Vlookup – Picking up first date and then picking up second date if there is one.

    You're very welcome

    If that takes care of your need, please mark this thread as solved.
    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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