Amended formula in C4
=IF(B4="","",IF(SUM((Targets!$A$2:$A$100=$A4)*(Targets!$B$2:$B$100=B$3)*(Targets!$D$2:$D$100="<="))>0,AGGREGATE(14,6,IF((Targets!$A$2:$A$100=$A4)*(Targets!$B$2:$B$100=B$3),(Targets!$E$2:$E$100)),SUM(IFERROR(FREQUENCY(B4,IF((Targets!$A$2:$A$100=$A4)*(Targets!$B$2:$B$100=B$3)*(Targets!$D$2:$D$100="<="),(Targets!$C$2:$C$100)))*(ROW(Targets!$A$2:$A$100)-1),0))),AGGREGATE(14,6,IF((Targets!$A$2:$A$100=$A4)*(Targets!$B$2:$B$100=B$3),(Targets!$E$2:$E$100)),SUM(IFERROR(FREQUENCY(-B4,IF((Targets!$A$2:$A$100=$A4)*(Targets!$B$2:$B$100=B$3)*(Targets!$D$2:$D$100=">="),(-Targets!$C$2:$C$100)))*(ROW(Targets!$A$2:$A$100)-1),0)))))
committed with Ctrl+Shift+Enter
Bookmarks