Earliest date with conditions

hrachao

New Member
Joined
Sep 19, 2018
Messages
16
Hi everyone,

Can't seem to make this work...

I have a table like this:

[TABLE="width: 215"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Vendor[/TD]
[TD]invoice nr[/TD]
[TD]invoice date[/TD]
[/TR]
[TR]
[TD]Alfa[/TD]
[TD]1[/TD]
[TD]11-10-2018[/TD]
[/TR]
[TR]
[TD]Beta[/TD]
[TD]23[/TD]
[TD]10-02-2017[/TD]
[/TR]
[TR]
[TD]Beta[/TD]
[TD]24[/TD]
[TD]01-03-2015[/TD]
[/TR]
[TR]
[TD]Delta[/TD]
[TD]58[/TD]
[TD]06-04-2016[/TD]
[/TR]
[TR]
[TD]Delta[/TD]
[TD]59[/TD]
[TD]07-04-2017[/TD]
[/TR]
[TR]
[TD]Delta[/TD]
[TD]60[/TD]
[TD]08-04-2018[/TD]
[/TR]
[TR]
[TD]Gama[/TD]
[TD]70[/TD]
[TD]01-06-2014[/TD]
[/TR]
[TR]
[TD]Sigma[/TD]
[TD]91[/TD]
[TD]02-06-2017[/TD]
[/TR]
[TR]
[TD]Sigma[/TD]
[TD]92[/TD]
[TD]03-06-2016
[/TD]
[/TR]
</tbody>[/TABLE]


And I need to find the earliest invoice date per vendor:

[TABLE="width: 199"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Vendor[/TD]
[TD]earliest invoice date[/TD]
[/TR]
[TR]
[TD]Alfa[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]Beta[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]Delta[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]Gama[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]Sigma[/TD]
[TD]?[/TD]
[/TR]
</tbody>[/TABLE]

Ideas?

Thanks for the help!

Helena
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Re: Help - earliest date with conditions

Like this:

=MIN(IF($A$2:$A$10=E1,$C$2:$C$10))

Enter CTRL-SHIFT-ENTER. Put a vendor to test in E1 and your table in A1:C10
 
Upvote 0
Re: Help - earliest date with conditions

Options using newer functions ..
If you have the MINIFS function (available in Excel 365) you can use the column B formula.
If you have at least Excel 2010 you can use the column C formula.

Excel Workbook
ABC
1Vendorinvoice nrinvoice date
2Alfa111/10/2018
3Beta2310/02/2017
4Beta241/03/2015
5Delta586/04/2016
6Delta597/04/2017
7Delta608/04/2018
8Gama701/06/2014
9Sigma912/06/2017
10Sigma923/06/2016
11
12
13Vendorearliest invoice date
14Alfa11/10/201811/10/2018
15Beta1/03/20151/03/2015
16Delta6/04/20166/04/2016
17Gama1/06/20141/06/2014
18Sigma3/06/20163/06/2016
Earliest Date
 
Upvote 0
Re: Help - earliest date with conditions

or you can try PowerQuery aka Get&Transform

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]Vendor[/td][td=bgcolor:#5B9BD5]invoice nr[/td][td=bgcolor:#5B9BD5]invoice date[/td][td][/td][td=bgcolor:#70AD47]Vendor[/td][td=bgcolor:#70AD47]Min[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Alfa[/td][td=bgcolor:#DDEBF7]
1​
[/td][td=bgcolor:#DDEBF7]
11/10/2018​
[/td][td][/td][td=bgcolor:#E2EFDA]Alfa[/td][td=bgcolor:#E2EFDA]
11/10/2018​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Beta[/td][td]
23​
[/td][td]
10/02/2017​
[/td][td][/td][td]Beta[/td][td]
01/03/2015​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Beta[/td][td=bgcolor:#DDEBF7]
24​
[/td][td=bgcolor:#DDEBF7]
01/03/2015​
[/td][td][/td][td=bgcolor:#E2EFDA]Delta[/td][td=bgcolor:#E2EFDA]
06/04/2016​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Delta[/td][td]
58​
[/td][td]
06/04/2016​
[/td][td][/td][td]Gama[/td][td]
01/06/2014​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Delta[/td][td=bgcolor:#DDEBF7]
59​
[/td][td=bgcolor:#DDEBF7]
07/04/2017​
[/td][td][/td][td=bgcolor:#E2EFDA]Sigma[/td][td=bgcolor:#E2EFDA]
03/06/2016​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Delta[/td][td]
60​
[/td][td]
08/04/2018​
[/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Gama[/td][td=bgcolor:#DDEBF7]
70​
[/td][td=bgcolor:#DDEBF7]
01/06/2014​
[/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]Sigma[/td][td]
91​
[/td][td]
02/06/2017​
[/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Sigma[/td][td=bgcolor:#DDEBF7]
92​
[/td][td=bgcolor:#DDEBF7]
03/06/2016​
[/td][td][/td][td][/td][td][/td][/tr]
[/table]


Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"invoice date", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Vendor"}, {{"Min", each List.Min([invoice date]), type date}})
in
    #"Grouped Rows"[/SIZE]
 
Upvote 0
Re: Help - earliest date with conditions

Thanks everyone! The formulas you guys presented work on the simplified table i gave as example, but not when I apply it to my real example... I still can't figure out why... trying to understand now (I get 00-01-1900) :S
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,021
Latest member
Justyna P

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