Hi
I’m using Office pro plus 2021.
I am trying to find the date of the maximum number, when 2 conditions are true, the year and a code. The following is an example sheet, in reality the sheet could contain 50000 rows of data and the columns may not be adjacent.
This sometimes can appear to work OK, but depending on the combination of date / number, can sometimes return a date for the wrong year.
=INDEX(C2:C22,MATCH(MAX(IF((B2:B22="A")*(YEAR(C2:C22)=2001),D2:D22)),D2:D22,0))
In the above I would expect 24/07/2001 to be the answer, but it returns 04/06/1995, which is the wrong year and code.
Any help appreciated.
I’m using Office pro plus 2021.
I am trying to find the date of the maximum number, when 2 conditions are true, the year and a code. The following is an example sheet, in reality the sheet could contain 50000 rows of data and the columns may not be adjacent.
This sometimes can appear to work OK, but depending on the combination of date / number, can sometimes return a date for the wrong year.
Code | Date | Number |
A | 02/06/1995 | 1 |
b | 03/06/1995 | 7 |
b | 04/06/1995 | 9 |
A | 05/06/1995 | 1 |
A | 06/06/1995 | 2 |
b | 07/06/1995 | 6 |
A | 08/06/1995 | 1 |
A | 09/08/1996 | 1 |
A | 10/08/1996 | 1 |
b | 11/08/1996 | 12 |
b | 12/08/1996 | 10 |
A | 13/08/1996 | 1 |
A | 14/08/1996 | 2 |
A | 15/08/1996 | 11 |
A | 16/08/1996 | 5 |
A | 24/07/2001 | 9 |
A | 25/07/2001 | 5 |
A | 26/07/2001 | 2 |
A | 27/07/2001 | 4 |
A | 28/07/2001 | 1 |
A | 29/07/2001 | 1 |
=INDEX(C2:C22,MATCH(MAX(IF((B2:B22="A")*(YEAR(C2:C22)=2001),D2:D22)),D2:D22,0))
In the above I would expect 24/07/2001 to be the answer, but it returns 04/06/1995, which is the wrong year and code.
Any help appreciated.