Return Matching Data from Most Recent Date based on condition
I am looking to return the result as Open or Close against the most recent date for each customer code. I have tried several formulas and combination of formulas.
Below is the data I’m working with.
DateCustomer CodeArticle01-01-2021101AA01-02-2021101DD01-03-2021101CC01-04-2021101CC01-05-2021101DD01-01-2021201BB01-02-2021201CC01-03-2021201DD01-04-2021201DD01-05-2021201AA
If everything works well, below is the result I required.
DateCustomer CodeArticleResult01-01-2021101AAClose01-02-2021101DDClose01-03-2021101CCClose01-04-2021101CCClose01-05-2021101DDOpen01-01-2021201BBClose01-02-2021201CCClose01-03-2021201DDClose01-04-2021201DDClose01-05-2021201AAOpen
Below is the formula I used to find out the article against latest date with respect to the customer code.
=FILTER($C$2:$C$11,($A$2:$A$11=MAXIFS($A$2:$A$11,$B$2:$B$11,B2))*($B$2:$B$11=B2))
But once I incorporated if function for returning open/close, I’m getting the below result which is wrong as highlighted.
=IF(FILTER($C$2:$C$11,($A$2:$A$11=MAXIFS($A$2:$A$11,$B$2:$B$11,B2))*($B$2:$B$11=B2))=C2,”Open”,”Close”)
DateCustomer CodeArticleResult01-01-2021101AAClose01-02-2021101DDOpen01-03-2021101CCClose01-04-2021101CCClose01-05-2021101DDOpen01-01-2021201BBClose01-02-2021201CCClose01-03-2021201DDClose01-04-2021201DDClose01-05-2021201AAOpen
Any help would be appreciated, thank you!
I am looking to return the result as Open or Close against the most recent date for each customer code. I have tried several formulas and combination of formulas. Below is the data I’m working with. DateCustomer CodeArticle01-01-2021101AA01-02-2021101DD01-03-2021101CC01-04-2021101CC01-05-2021101DD01-01-2021201BB01-02-2021201CC01-03-2021201DD01-04-2021201DD01-05-2021201AA If everything works well, below is the result I required. DateCustomer CodeArticleResult01-01-2021101AAClose01-02-2021101DDClose01-03-2021101CCClose01-04-2021101CCClose01-05-2021101DDOpen01-01-2021201BBClose01-02-2021201CCClose01-03-2021201DDClose01-04-2021201DDClose01-05-2021201AAOpen Below is the formula I used to find out the article against latest date with respect to the customer code. =FILTER($C$2:$C$11,($A$2:$A$11=MAXIFS($A$2:$A$11,$B$2:$B$11,B2))*($B$2:$B$11=B2)) But once I incorporated if function for returning open/close, I’m getting the below result which is wrong as highlighted. =IF(FILTER($C$2:$C$11,($A$2:$A$11=MAXIFS($A$2:$A$11,$B$2:$B$11,B2))*($B$2:$B$11=B2))=C2,”Open”,”Close”) DateCustomer CodeArticleResult01-01-2021101AAClose01-02-2021101DDOpen01-03-2021101CCClose01-04-2021101CCClose01-05-2021101DDOpen01-01-2021201BBClose01-02-2021201CCClose01-03-2021201DDClose01-04-2021201DDClose01-05-2021201AAOpen Any help would be appreciated, thank you! Read More