When you embed an IF into a SUMPRODUCT invariably it necessitates Array entry ... this is why for ex. you get the correct answer in fx but not in cell - the former evaluates as an Array whereas the latter is not (presently).
Goes without saying that if you use SUMPRODUCT with Array entry then generally speaking you may as well just use an Array as it's more flexible than SUMPRODUCT
(the advantage of SUMPRODUCT is that it doesn't require Array entry - it's not really any more efficient)
Without seeing a sample it's hard to know if a SEARCH approach would suffice but in the meantime the below should work I think:
SIGN(((F$6:F$204=AH$31)*(AH$31>0))+((F$6:F$204>0)*(AH$31=0)))
the above [in essence an OR(AND(),AND()) and the SIGN is used to avoid double counting] and is to replace the below in full:
--IF(AH$31>0,(F$6:F$204=AH$31),(F$6:F$204>0))
So you end up with:
=SUMPRODUCT(SIGN(((F$6:F$204=AH$31)*(AH$31>0))+((F$6:F$204>0)*(AH$31=0))),(E$6:E$204+((E$6:E$204<AH$23)*(AH$23>AH$24))>=AH$23),($E$6:$E$204+(($E$6:$E$204<AH$23)*(AH$23>AH$24))<=(AH$24+(AH$23>AH$24))),--(G$6:G$204=AI31))
note I removed some superfluous double unary coercion
Bookmarks