'Counting transactions considering unique values and dates with formula

I am attempting to retrieve the count of unique transactions through Excel with the below formula:

=COUNTIFS('CA SAP'!$E:$E,Synthèse!A14,'CA SAP'!$P:$P,">="&Synthèse!D4,'CA SAP'!$P:$P,"<="&Synthèse!E4,'CA SAP'!$N:$N,">0")

Synthèse! A14 is the name of the website Synthèse! D4 & Synthèse! E4 are both dates CA SAP'!$N:$N,">0" is for the transaction amount.

There is a column CA SAP'!$T:$T where I am trying to retrieve the distinct values as well I am trying to count the distinct transactions given a time period for a transaction above 0.

I have written the below formula but I am unable to get any correct results with it, the above formula works well however it includes duplicate values from CA SAP'!$T:$T

=COUNTIFS('CA SAP'!$E:$E,Synthèse!A11,'CA SAP'!$P:$P,">="&Synthèse!D4,'CA SAP'!$P:$P,"<="&Synthèse!E4,'CA SAP'!$T:$T,"="&UNIQUE('CA SAP'!$T:$T),'CA SAP'!$N:$N,">""0")

I have added a picture of the data below.



Solution 1:[1]

=COUNTA(UNIQUE(FILTER('CA SAP'!$T:$T, ('CA SAP'!$E:$E=Synthèse!A14)*('CA SAP'!$P:$P >= Synthèse!D4)*('CA SAP'!$P:$P <= Synthèse!E4)*('CA SAP'!$N:$N > 0))))

The FILTER() formula applies the criteria to the transactions, the UNIQUE() removes duplicates and then COUNTA gives the count of the result.

See here for a guide to FILTER function with multiple criteria.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Spencer Barnes