Multiple criteria sumif array formula with logic

I’ve recorded the issue below as well