Index match/VBA/Vlookup

Tocix

New Member
Joined
Apr 17, 2016
Messages
45
Office Version
  1. 365
Hello,

I have a workbook with two worksheet. Please help me out with anything Vlookup/Index match, VBA etc..

On sheet1 I have column A= part number, column G=price and column M=location. On sheet2 I have column A= part number, column D= date, column M=price and column K=location.

On sheet2 on Column A has same item number with multiple rows with different date on column D. is there a way that can be done in VBA/Vlookup anything that look up the oldest date and copy price on column G and location to sheet1?


Thank you very much. This would save me half day of work
sheet1
AGM
Part numberPriceLocation
1G1APPLE8.00B13
2G2PEAR9.00b5
3G3ORANGE
4
5

<tbody>
</tbody>



adkm
part numberdatelocationprice
1G1APPLE10/08/2019B125.00
2G1APPLE10/01/2019B138.00
3G2PEAR10/03/2019B59.00
4G2PEAR12/05/2019B66.50
5

<tbody>
</tbody>
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try this array formula

<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:158.73px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td >Part number</td><td >Price</td><td >Location</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td >G1APPLE</td><td style="text-align:right; ">8</td><td >B13</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td >G2PEAR</td><td style="text-align:right; ">9</td><td >B5</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td >G3ORANGE</td><td > </td><td > </td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Array Formula</td></tr><tr><td >B2</td><td >{=IFERROR(INDEX(Sheet2!$D$2:$D$5,MAX((Sheet2!$A$2:$A$5=$A2)*(Sheet2!$B$2:$B$5=MIN(IF(Sheet2!$A$2:$A$5=$A2,Sheet2!$B$2:$B$5)))*ROW(Sheet2!$D$2:$D$5)-ROW(Sheet2!$D$1))),"")}</td></tr><tr><td >C2</td><td >{=IFERROR(INDEX(Sheet2!$C$2:$C$5,MAX((Sheet2!$A$2:$A$5=$A2)*(Sheet2!$B$2:$B$5=MIN(IF(Sheet2!$A$2:$A$5=$A2,Sheet2!$B$2:$B$5)))*ROW(Sheet2!$D$2:$D$5)-ROW(Sheet2!$D$1))),"")}</td></tr></table></td></tr></table>

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

After entering the 2 formulas copy down.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,669
Members
448,977
Latest member
moonlight6

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