I've started approaching it with sumifs
, but it seems to get too troublesome, long and unmaintainable pretty soon.
=IF(E2=true;SUMIFS(P:P;H:H;E1;L:L;$A$2;K:K;F4); IF(D2=true;SUMIFS(P:P;H:H;D1;L:L;$A$2;K:K;F4)))
Here's the file with the data: https://docs.google.com/spreadsheets/d/1gh5w0czg2JuoA3i5wPu8_eOpC4Q4TXIRhmUrg53nKMU/edit?usp=sharing
Added a possible solution here for you to test out:
=sum(ifna(filter(R:R;(xmatch(J:J;filter(B2:B10;A2:A10))*(xmatch(N:N;C2:C10))*(xmatch(M:M;filter(D2:D10;E2:E10)))))))