You could use SUMPRODUCT
instead, where you can use ranges:
=SUMPRODUCT(--(A:A<B:B-120))
If A:A is smaller than B:B after removing 120 days, then (A:A<B:B-120)
will return true for each row where this applies, and false otherwise.
--
at the start will convert those to 1s and 0s respectively and SUMPRODUCT
add them.
Note that the formula will be faster if you use a smaller range, e.g. A1:A100 and B1:B100 (or whatever range you're counting).
Try using this if you have non-dates in your range as well:
=SUM(IFERROR(A:A<B:B-120,0)*1)
And press Ctrl+Shift+Enter after typing in the formula to array invoke it (you can use SUMPRODUCT
, but it will require the array invocation so you might as well just use SUM
) .