mardi 22 septembre 2015

Using index match to find to pick from highest value between two tables - Excel

I use this sheet to track the location of different things based off hard input from shipping schedules. I'm working with 3 tables, the first is a list of all materials (3 columns that matter: Identifier 1, Identifier 2, and Location) the second has the shipping out of plant A (Identifier 1, Identifier 2, Shipping Date). The last has the shipping out of plant B (same as the plant A table). All materials are identified by two separate columns.

    ____A_______B_______C_______D_____E_______F_______G_________H____I______J________K______
    ___ID#1_|_ID#2_|_Location_|____|_ID#1_|_ID#2_|_Ship Date_|____|ID#1_|_ID#2_|_Ship Date_|
    1___A___|__1___|__________|____|__A___|___2__|_9/17/15___|____|_B___|__2___|_9/15/15___|
    2___A___|__2___|__________|____|__A___|___1__|_9/18/15___|____|_B___|__2___|_9/18/15___|
    3___A___|__3___|__________|____|__B___|___2__|_9/18/15___|____|_A___|__1___|_9/19/15___|
    4___B___|__1___|__________|____|__C___|___1__|_9/19/15___|____|_B___|__1___|_9/20/15___|
    5___B___|__2___|__________|____|__A___|___3__|_9/21/15___|____|_C___|__1___|_9/22/15___|
    6___C___|__1___|__________|____|__A___|___1__|_9/22/15___|____|_C___|__2___|_9/22/15___|
    7___C___|__2___|__________|____|______|______|___________|____|_____|______|___________|

There is a lot of shipping back and fourth. So, my original plan was to have an index/match lookup the highest date value between the two shipping tables, and return that to the location column as either 'Plant A' (If the most recent date is on the Plant B table) or 'Plant B' (If the most recent date is on the Plant A table). I could't figure that out at all. I ended up just adding two columns that looked up the shipping date from each table, and then with the location column, I just did if this is bigger than that "Plant A" if false "Plant B" and hid the two columns (that formula looked like =index(table2,(Match(a1&B1,E:E&F:F,0)),1)...) but then I realized that it was pulling the oldest date from the second two tables instead of the newest one... making it worthless.

So, I guess my first question is, how do you get an index/match function to find the highest value, and my second, is there any way to do it how I wanted to originally (I tried using multiple index/match functions nested in an If function but it was super messy and refused to work) or should I just keep my two hidden columns set up going?

Thanks!

Aucun commentaire:

Enregistrer un commentaire