See attached example.
Sumproduct, but with no array formula (and no added column). I changed your Sheet2 range to Table for flexibility.
Be careful that in your sheet2, sometimes there is a net and a invoiced, but no rev amt. In this case nothing is added, as I exactly applied your request (i.e. sum invoiced only if there is net and rev amt and invoiced).
- Net will be added if both rev amt and invoiced are 0 => (Table1[NET]*(Table1[REV AMT]=0)*(Table1[INVOICED]=0).
- Rev Amt will be added if net is not 0, and invoiced is 0 => (Table1[REV AMT]*(Table1[NET]<>0)*(Table1[INVOICED]=0))
- Invoiced will be added if none of them is 0 => (Table1[INVOICED]*(Table1[NET]<>0)*(Table1[REV AMT]<>0))
This will happen only when
- the office # is matching the office #of the column => --(Table1[OFFICE]=VALUE(RIGHT(E$1,1))), where -- will cast the TRUE/FALSE value to 1 / 0
- The month is matching the month in the row => --(TEXT(Table1[START DATE],"mmmm")=$A2))
Full formula for cell E2:
=SUMPRODUCT
((Table1[NET]
*(Table1[REV AMT]=0)
*(Table1[INVOICED]=0)
)+(Table1[REV AMT]
*(Table1[NET]<>0)
*(Table1[INVOICED]=0)
)+(Table1[INVOICED]
*(Table1[NET]<>0)
*(Table1[REV AMT]<>0)
),
--
(Table1[OFFICE]=VALUE(RIGHT(E$1,1))
),
--
(TEXT(Table1[START DATE],"mmmm")=$A2
)).