Pulling last cost of items

Jongo1

New Member
Joined
Aug 8, 2016
Messages
24
I have a sheet set up like such:



Item No.Purch Date Cost
Item 11/18/201612.4
Item 12/1/201611.12
Item 23/22/201643.2
Item 24/18/201655
Item 34/22/2016100
Item 35/13/2016125
Item 36/17/2016300

<tbody>
</tbody>


It goes on and on for 20,000 rows. What I need to do is extract the most recent cost by date for each item and then I need to extract the date when that last purchase was made for that item. I feel like its a simple formula that I can't think of.
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Assuming this data set, all formulas will need to be adjusted to fit your needs


Book1
ABC
1Item No.Purch DateCost
2Item 118/01/201612.4
3Item 101/02/201611.12
4Item 222/03/201643.2
5Item 218/04/201655
6Item 322/04/2016100
7Item 313/05/2016125
8Item 317/06/2016300
Sheet1



Book1
GHIJ
1Item No.Last PurchasedLast Price PaidNon-Array
2Item 101/02/201611.1211.12
3Item 218/04/20165555
4Item 317/06/2016300300
Sheet1
Cell Formulas
RangeFormula
H2=AGGREGATE(14, 6, ($B$2:$B$8)/($A$2:$A$8=G2), 1)
J2=INDEX($C$2:$C$8, AGGREGATE(14, 6, (ROW($A$2:$A$8)-ROW($A$2)+1)/(($A$2:$A$8=G2)*($B$2:$B$8=H2)), 1))
I2{=INDEX($C$2:$C$8, MATCH(G2&H2, $A$2:$A$8&$B$2:$B$8, 0))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Assuming this data set, all formulas will need to be adjusted to fit your needs

ABC
1Item No.Purch DateCost
2Item 118/01/201612.4
3Item 101/02/201611.12
4Item 222/03/201643.2
5Item 218/04/201655
6Item 322/04/2016100
7Item 313/05/2016125
8Item 317/06/2016300

<tbody>
</tbody>
Sheet1



GHIJ
1Item No.Last PurchasedLast Price PaidNon-Array
2Item 101/02/201611.1211.12
3Item 218/04/20165555
4Item 317/06/2016300300

<tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
H2=AGGREGATE(14, 6, ($B$2:$B$8)/($A$2:$A$8=G2), 1)
J2=INDEX($C$2:$C$8, AGGREGATE(14, 6, (ROW($A$2:$A$8)-ROW($A$2)+1)/(($A$2:$A$8=G2)*($B$2:$B$8=H2)), 1))

<tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
I2{=INDEX($C$2:$C$8, MATCH(G2&H2, $A$2:$A$8&$B$2:$B$8, 0))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>


Thank you very much, but I noticed a huge flaw in how I reported this. There is another big element to it all.


This is incorrect

ABC
1Item No.Purch DateCost
2Item 118/01/201612.4
3Item 101/02/201611.12
4Item 222/03/201643.2
5Item 218/04/201655
6Item 322/04/2016100
7Item 313/05/2016125
8Item 317/06/2016300

<tbody>
</tbody>

Each Item has multiple vendors. So it would be last cost by date per vendor per item.

ItemVendorPurchase DateCost
Item 1Vendor 11/1/20165
Item 1Vendor 11/1/20175
Item 1Vendor 22/1/20162
Item 1Vendor 32/1/20153
Item 2Vendor 41/1/20186
Item 2Vendor 11/5/20181
Item 2Vendor 21/6/20187
Item 3Vendor 512/2/20173
Item 3Vendor 510/3/20171

<tbody>
</tbody>

I would want to show what the last price was for that specific item for each vendor.
 
Last edited:
Upvote 0
Got it. Used a If(max() for the date requirements and then added the extra criteria to the index array formula.
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top