First you need to alter J2 to be 25- (double listing 24 presently)
Second, to avoid horrendous formulae I would advise creating a concatenation key in O, such that:
O12: =LEFT(K12,2)&"#"&L12
copied down for all rows
Then for results of unique Inv numbers...
E3:
=SUMPRODUCT(--(LEFT($K$12:$K$300,LEN(E$2))=E$2),--($M$12:$M$300<=$D3),1/COUNTIF($O$12:$O$300,$O$12:$O$300&""))
copied across to L3
E4:
=SUMPRODUCT(--(LEFT($K$12:$K$300,LEN(E$2))=E$2),--($M$12:$M$300>=$C4),--($M$12:$M$300<=$D4),1/COUNTIF($O$12:$O$300,$O$12:$O$300&""))
copied across to L4
For the summation copy E3:E4 to E6:E7 but alter the final argument of the SUMPRODUCT from: 1/COUNTIF(...) to simply $I$12:$I$300
You may want to think about using Dynamic Named Ranges in the Long Term.
Bookmarks