Minimum of the multiple dates for a Product

soumen21

New Member
Joined
Aug 16, 2019
Messages
29
Hi,

I have a list of products and associated dates. A product will have multiple materials and each material have a expiry date. Something like table below.

ProductMaterialMaterial Expiry
AAa16-Aug-23
AAb17-May-23
BBb18-Aug-25
AAc19-Aug-22
CCb20-Aug-26
AAd21-Feb-20
BBa22-Aug-24
CCa23-Dec-19

<colgroup><col span="2"><col></colgroup><tbody>
</tbody>

I want to run a query where say I want to look for product 'AA' and say its expiry date. For example 'AA' has material 'd' whose expiry date is 21-Feb-20. So for query for expiry of product AA, I should get the earliest of all dates, in this case 21-Feb-20.
Could you please help with the excel formula to find this out?

Regards
Soumen
 

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.
you can try PowerQuery (Get&Transform)

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Product", type text}, {"Material", type text}, {"Material Expiry", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Product"}, {{"Min Date", each List.Min([Material Expiry]), type date}})
in
    #"Grouped Rows"[/SIZE]

ProductMaterialMaterial ExpiryProductMin Date
AAa
16/08/2023​
AA
21/02/2020​
AAb
17/05/2023​
BB
22/08/2024​
BBb
18/08/2025​
CC
23/12/2019​
AAc
19/08/2022​
CCb
20/08/2026​
AAd
21/02/2020​
BBa
22/08/2024​
CCa
23/12/2019​
 
Upvote 0
Could you please help with the excel formula to find this out?
Is this what you mean?

Excel Workbook
ABCDEF
1ProductMaterialMaterial ExpiryProductAA
2AAa16-Aug-23Earliest Expiry21-Feb-20
3AAb17-May-23
4BBb18-Aug-25
5AAc19-Aug-22
6CCb20-Aug-26
7AAd21-Feb-20
8BBa22-Aug-24
9CCa23-Dec-19
Earliest Date
 
Upvote 0
I want to add one of column with "status" as open or close. If the status is open then only the earliest of the date will be shown. As per example, as per the table below

StatusProductMaterial Expiry
ClosedAA16-Aug-19
OpenAA17-May-23
ClosedBB18-Aug-25
OpenAA19-Aug-22
OpenCC20-Aug-26
ClosedAA21-Feb-20
OpenBB22-Aug-24
ClosedCC23-Dec-19

<colgroup><col><col><col></colgroup><tbody>
</tbody>

Product AA will show earliest date as 19-Aug-22 (not 21-Feb-20) among the earliest of the dates as the status is still open.
 
Upvote 0
Expanding on Peter's formula

Book1
ABCDEF
1StatusProductMaterial ExpiryProductAA
2ClosedAA16-Aug-19Earliest Expiry19-Aug-22
3OpenAA17-May-23
4ClosedBB18-Aug-25
5OpenAA19-Aug-22
6OpenCC20-Aug-26
7ClosedAA21-Feb-20
8OpenBB22-Aug-24
9ClosedCC23-Dec-19
Norfolk
Cell Formulas
RangeFormula
F2=AGGREGATE(15,6,$C$2:$C$9/(($B$2:$B$9=F1)*(A2:A9="Open")),1)
 
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

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