I have looked high and low for an answer on this and i am sure it is right in front of me.

I want to return NA() if the date value in AB2 is less than the date values in A2:A50000. With the formula below I get a #VALUE! result.

Where am I going wrong? Thank you.

=IF(Data!$A$2:$A$50000>DATEVALUE(AB2),NA(),SUMPRODUCT((Data!$A$2:$A$50000>=AB$2)*(Data!$A$2:$A$50000<=AB$3)*(Data!$D$2:$D$50000=$A6),(Data!$E$2:$E$50000)))