Most recent price in a data set

vgr

New Member
Joined
May 25, 2012
Messages
15
Hi
I was going through some sale data which had customer name, item code, item description, cost/unit, quantity and value.

[TABLE="width: 457"]
<colgroup><col><col span="6"></colgroup><tbody>[TR]
[TD]Date[/TD]
[TD]Customer[/TD]
[TD]Item code[/TD]
[TD]Item Desc[/TD]
[TD]Cost/unit[/TD]
[TD]quantity[/TD]
[TD]value[/TD]
[/TR]
[TR]
[TD="align: right"]01-02-2013[/TD]
[TD]BAM[/TD]
[TD]A3[/TD]
[TD]three[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]370[/TD]
[TD="align: right"]5180[/TD]
[/TR]
[TR]
[TD="align: right"]02-02-2013[/TD]
[TD]CAM[/TD]
[TD]A1[/TD]
[TD]one[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]157[/TD]
[TD="align: right"]1570[/TD]
[/TR]
[TR]
[TD="align: right"]03-02-2013[/TD]
[TD]DAM[/TD]
[TD]A2[/TD]
[TD]three[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]344[/TD]
[TD="align: right"]4816[/TD]
[/TR]
[TR]
[TD="align: right"]04-02-2013[/TD]
[TD]BAM[/TD]
[TD]A3[/TD]
[TD]three[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]376[/TD]
[TD="align: right"]4888[/TD]
[/TR]
[TR]
[TD="align: right"]05-02-2013[/TD]
[TD]CAM[/TD]
[TD]A2[/TD]
[TD]three[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]194[/TD]
[TD="align: right"]2328[/TD]
[/TR]
[TR]
[TD="align: right"]06-02-2013[/TD]
[TD]DAM[/TD]
[TD]A3[/TD]
[TD]three[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]547[/TD]
[TD="align: right"]5470[/TD]
[/TR]
[TR]
[TD="align: right"]07-02-2013[/TD]
[TD]BAM[/TD]
[TD]A3[/TD]
[TD]three[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]291[/TD]
[TD="align: right"]1455[/TD]
[/TR]
[TR]
[TD="align: right"]08-02-2013[/TD]
[TD]CAM[/TD]
[TD]A3[/TD]
[TD]three[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]300[/TD]
[TD="align: right"]1800[/TD]
[/TR]
[TR]
[TD="align: right"]09-02-2013[/TD]
[TD]DAM[/TD]
[TD]A1[/TD]
[TD]one[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]91[/TD]
[TD="align: right"]1365[/TD]
[/TR]
[TR]
[TD="align: right"]10-02-2013[/TD]
[TD]BAM[/TD]
[TD]A3[/TD]
[TD]three[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]222[/TD]
[TD="align: right"]2886[/TD]
[/TR]
[TR]
[TD="align: right"]11-02-2013[/TD]
[TD]CAM[/TD]
[TD]A3[/TD]
[TD]three[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]374[/TD]
[TD="align: right"]4114[/TD]
[/TR]
[TR]
[TD="align: right"]12-02-2013[/TD]
[TD]DAM[/TD]
[TD]A1[/TD]
[TD]one[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]277[/TD]
[TD="align: right"]3601[/TD]
[/TR]
[TR]
[TD="align: right"]13-02-2013[/TD]
[TD]CAM[/TD]
[TD]A1[/TD]
[TD]one[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]434[/TD]
[TD="align: right"]3906[/TD]
[/TR]
</tbody>[/TABLE]


How do I compare the latest price per item for each customer?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi. Let's try this.

Excel 2012
ABCDEFGHIJK
DateCustomerItem codeItem DescCost per unitQuantityValuelast for each Customer
BAMA3three
CAMA1one
DAMA2three
BAMA3three
CAMA2three
DAMA3three
BAMA3three
CAMA3three
DAMA1one
BAMA3three
CAMA3three
DAMA1one
CAMA1one

<colgroup><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]February 1, 2013[/TD]

[TD="align: right"]14[/TD]
[TD="align: right"]370[/TD]
[TD="align: right"]5180[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #E7E6E6"]BAM[/TD]
[TD="bgcolor: #E2EFDA, align: right"] $ 13.00 [/TD]
[TD="bgcolor: #E2EFDA, align: right"]February 10, 2013[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]February 2, 2013[/TD]

[TD="align: right"]10[/TD]
[TD="align: right"]157[/TD]
[TD="align: right"]1570[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #E7E6E6"]CAM[/TD]
[TD="bgcolor: #E2EFDA, align: right"] $ 9.00 [/TD]
[TD="bgcolor: #E2EFDA, align: right"]February 13, 2013[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]February 3, 2013[/TD]

[TD="align: right"]14[/TD]
[TD="align: right"]344[/TD]
[TD="align: right"]4816[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #E7E6E6"]DAM[/TD]
[TD="bgcolor: #E2EFDA, align: right"] $ 13.00 [/TD]
[TD="bgcolor: #E2EFDA, align: right"]February 12, 2013[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]February 4, 2013[/TD]

[TD="align: right"]13[/TD]
[TD="align: right"]376[/TD]
[TD="align: right"]4888[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]February 5, 2013[/TD]

[TD="align: right"]12[/TD]
[TD="align: right"]194[/TD]
[TD="align: right"]2328[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]February 6, 2013[/TD]

[TD="align: right"]10[/TD]
[TD="align: right"]547[/TD]
[TD="align: right"]5470[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]February 7, 2013[/TD]

[TD="align: right"]5[/TD]
[TD="align: right"]291[/TD]
[TD="align: right"]1455[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]February 8, 2013[/TD]

[TD="align: right"]6[/TD]
[TD="align: right"]300[/TD]
[TD="align: right"]1800[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]February 9, 2013[/TD]

[TD="align: right"]15[/TD]
[TD="align: right"]91[/TD]
[TD="align: right"]1365[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]February 10, 2013[/TD]

[TD="align: right"]13[/TD]
[TD="align: right"]222[/TD]
[TD="align: right"]2886[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]12[/TD]
[TD="align: right"]February 11, 2013[/TD]

[TD="align: right"]11[/TD]
[TD="align: right"]374[/TD]
[TD="align: right"]4114[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]13[/TD]
[TD="align: right"]February 12, 2013[/TD]

[TD="align: right"]13[/TD]
[TD="align: right"]277[/TD]
[TD="align: right"]3601[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]14[/TD]
[TD="align: right"]February 13, 2013[/TD]

[TD="align: right"]9[/TD]
[TD="align: right"]434[/TD]
[TD="align: right"]3906[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet7

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10, bgcolor: #DAE7F5"]J2[/TH]
[TD="align: left"]=INDEX($E$2:$E$14,SUMPRODUCT(MAX(($B$2:$B$14=$I2)*ROW($B$2:$B$14)))-ROW($A$2:$A$14)+1)[/TD]
[/TR]
[TR]
[TH="width: 10, bgcolor: #DAE7F5"]K2[/TH]
[TD="align: left"]=INDEX($A$2:$A$14,SUMPRODUCT(MAX(($B$2:$B$14=$I2)*ROW($B$2:$B$14)))-ROW($A$2:$A$14)+1)[/TD]
[/TR]
[TR]
[TH="width: 10, bgcolor: #DAE7F5"]J3[/TH]
[TD="align: left"]=INDEX($E$2:$E$14,SUMPRODUCT(MAX(($B$2:$B$14=I3)*ROW($B$2:$B$14)))-ROW($A$2:$A$14)+1)[/TD]
[/TR]
[TR]
[TH="width: 10, bgcolor: #DAE7F5"]K3[/TH]
[TD="align: left"]=INDEX($A$2:$A$14,SUMPRODUCT(MAX(($B$2:$B$14=$I3)*ROW($B$2:$B$14)))-ROW($A$2:$A$14)+1)[/TD]
[/TR]
[TR]
[TH="width: 10, bgcolor: #DAE7F5"]J4[/TH]
[TD="align: left"]=INDEX($E$2:$E$14,SUMPRODUCT(MAX(($B$2:$B$14=I4)*ROW($B$2:$B$14)))-ROW($A$2:$A$14)+1)[/TD]
[/TR]
[TR]
[TH="width: 10, bgcolor: #DAE7F5"]K4[/TH]
[TD="align: left"]=INDEX($A$2:$A$14,SUMPRODUCT(MAX(($B$2:$B$14=$I4)*ROW($B$2:$B$14)))-ROW($A$2:$A$14)+1)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,224,115
Messages
6,176,479
Members
452,729
Latest member
fizzay_pop

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