Index Match Returning Duplicates Against Multiple Conditions

Copper Contributor

Hi there,

I am running a new task for reporting and am unable to get a unique list of results based on multiple conditions. 

The result I'm expecting is a unique list of IDs ordered by the highest number of orders in-between 10 and 20. Any help would be much appreciated!

=INDEX(Sales_Data!$D:$D, MATCH(1,(IF(Sales_Data!$H:$H>10,IF(Sales_Data!$H:$H<21,IF(Sales_Data!$T:$T=$C$5,IF(Sales_Datas!$A:$A=$G$5,Sales_Data!$M:$M))))=LARGE(IF(Sales_Data!$H:$H>10,IF(Sales_Data!$H:$H<21,IF(RSales_Data!$T:$T=$C$5,IF(Sales_Data!$A:$A=$G$5,Sales_Data!$M:$M)))),'Monthly Report'!$B124))*(COUNTIF(C$123:C123, Sales_Data!$D:$D)=0), 0))

However, some of these IDs are repeated month on month.

I'd equally accept an alternate solution!

Thank you

1 Reply

@yeeyee OK per the advice of the pinned message in this forum it is very helpful to include what version of excel you are using and a sample file/worksheet with the data you have and what you want.  This formula is very hard to put into context but I do notice some things that might help.

First off, if you have excel 365 then you have access to new functions like UNIQUE and FILTER and SORT and LET which can make this much easier. 

Second, you could and should at least use the AND() function or multiply the conditionals instead of all those nested IF()

Third, your formula is using FIXED references in almost every case meaning if you copy this formula down it will not change that reference.  In some cases that is what you want but in this type of formula I suspect the references to $C$5 and $G$5 are really supposed to be C5 and G5 (or could be $C5 and $G5) so when you copy down each cell will reference a different corresponding cell (e.g. on the same row but in columns C and G).  That said, this section of the formula:

       'Monthly Report'!$B124))*(COUNTIF(C$123:C123, 

is using RELATIVE references so they will change as you copy down and I'm not sure if you want that.

 

again it is really hard for me to know what is or isn't wrong without the sheet.