Formula to return a value based on criteria

helpme20

Board Regular
Joined
Aug 28, 2010
Messages
102
I am looking for a formula to produce a value based on the last date.

Column A is the Product Name
Column B is the Date of Purchase
Column C is the Product Cost by Unit of Measure


Can someone help me with the formula in Column D to return the Last Product Cost (Column C) for the most recent purchase (Column B) of the Product name (Column A) ?


Thank you very much.

Brian
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
If dates are in chronological order, in D2 entrer and copy down:

=LOOKUP(9.99999999999999E+307,1/($A$2:$A$400=$A2),$C$2:$C$400)

which might suffice.
 
Upvote 0
I appreciate the response, but that is not returning the right values. The information is sorted by column A (this has multiple product names in this column) and then column B, newest to oldest.
 
Upvote 0
I appreciate the response, but that is not returning the right values. The information is sorted by column A (this has multiple product names in this column) and then column B, newest to oldest.

Does this work?

=INDEX($C$2:$C$400,MATCH($A2,INDEX($A$2:$A$400,0),0))
 
Upvote 0
I am looking for a formula to produce a value based on the last date.

Column A is the Product Name
Column B is the Date of Purchase
Column C is the Product Cost by Unit of Measure

Can someone help me with the formula in Column D to return the Last Product Cost (Column C) for the most recent purchase (Column B) of the Product name (Column A) ?

Thank you very much.

Brian

Hi!

Maybe the the Array Formula (use Ctrl+Shift+Enter to enter the formula) below can helps.

In D2 and copy down

=IF(COUNTIF(A$2:A2,A2)>1,"",
LARGE(IF(B$2:B$17=LARGE(IF(A$2:A$17=A2,B$2:B$17),1),C$2:C$17),1))


ABCDE
1ProductData of PurchaseCost by Unit of MeasureLast Cost
2Product1401/01/2018153192
3Product1302/01/2018279279
4Product1003/01/2018224224
5Product1204/01/2018271271
6Product1405/01/2018198
7Product1106/01/2018287182
8Product1407/01/2018132
9Product1208/01/2018136
10Product1509/01/2018227291
11Product1110/01/2018260
12Product1111/01/2018182
13Product1212/01/2018117
14Product1413/01/2018279
15Product1514/01/2018291
16Product1215/01/2018271
17Product1416/01/2018192
18
**********************************************

<tbody>
</tbody>


Markmzz
 
Upvote 0
You can try the formula below too:

=IF(COUNTIF(A$2:A2,A2)>1,"",INDEX(C$2:C$17,MATCH(1,
INDEX(1*((A$2:A$17=A2)*(B$2:B$17)=LARGE((A$2:A$17=A2)*B$2:B$17,1)),),0)))


Markmzz
 
Last edited:
Upvote 0
You can try the formula below too:

=IF(COUNTIF(A$2:A2,A2)>1,"",INDEX(C$2:C$17,MATCH(1,
INDEX(1*((A$2:A$17=A2)*(B$2:B$17)=LARGE((A$2:A$17=A2)*B$2:B$17,1)),),0)))


Markmzz


This one worked. Thank you. I could not get the formula in the previous post to work.
 
Upvote 0
Hi!

Maybe the the Array Formula (use Ctrl+Shift+Enter to enter the formula) below can helps.

In D2 and copy down

=IF(COUNTIF(A$2:A2,A2)>1,"",
LARGE(IF(B$2:B$17=LARGE(IF(A$2:A$17=A2,B$2:B$17),1),C$2:C$17),1))

Markmzz

This one worked. Thank you. I could not get the formula in the previous post to work.

You are welcome and thanks for the feedback.

By the way, for the first formula (array formula) to work, you must to press Ctrl+Shift+Enter to enter the formula.

Markmzz
 
Upvote 0

Forum statistics

Threads
1,215,026
Messages
6,122,738
Members
449,094
Latest member
dsharae57

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