Reputation: 331
Let imagine, we have this table from column A to C
A | B | C |
---|---|---|
Date | Name | Price |
10/01/2020 | aa | 5 |
10/01/2020 | bb | 5 |
15/01/2020 | aa | 5 |
Now I have two lines :
F | G | H |
---|---|---|
12/01/2020 | aa | ? |
16/01/2020 | aa | ? |
How can I automatically fill the "?" next to the two lines ? There is two criteria :
Upvotes: 0
Views: 39
Reputation: 1507
Formula for H1
is
=SUMIFS($C$2:$C$4,$A$2:$A$4,MINIFS($A$2:$A$4,$A$2:$A$4,">="&F1,$B$2:$B$4,G1),$B$2:$B$4,G1)
Then copy to H2
. It returns 0 for H2
since 16/01/20 is greater than all of the dates in column A.
Upvotes: 1
Reputation: 152525
With Office 365 dynamic arrays:
=@SORTBY(FILTER($C$2:$C$5,($A$2:$A$5>F1)*($B$2:$B$5=G1),""),FILTER($A$2:$A$5,($A$2:$A$5>F1)*($B$2:$B$5=G1),""))
If one has LET() it can be shortened to:
=LET(dt,$A$2:$A$5,x,(dt>F1)*($B$2:$B$5=G1),@SORTBY(FILTER($C$2:$C$5,x,""),FILTER(dt,x,"")))
Upvotes: 0