I need help building a conditional summation formula.

I want to sum the values in cells J36, R36, Z36, AH36, AP36, AR36, AY36, BG36, BO36, BW36, CE36, CG36, CN36 and CV36 and put the sum in Cell CZ4 and

to sum the values in cells L35, T35, AB35, AJ35, AS35, BA35, BI35, BQ35, BY35, CH35, CP35, and CX35 put the sum in Cell DA4

for only those weeks where the activation 'X' appears in the shaded cells in row 2 for the week.

That is, I am trying to get the sums calculated for cells CZ4 and DA4 for just those weeks where the activation 'X' appears in the shaded cells for the weeks in Row 2. I do not want the summation formulas in CZ4 and DA4 to consider any weeks other than those which are thus activated.

The simple sum formulas in CZ4 and DA4 are, I assume, returning #VALUE because there are no numbers (only blanks formatted as "") in rows 35 and 36 for those weeks not yet activated. (The cell formatting in the weekly totals footers is designed to hide these weekly totals cells until the week is activated in Row 2.) For the unactivated weeks, the totals cells at the bottom of the weekly columns are formatted to show blanks ("") until the week is activated, and, I assume, the simple summation formulas will not add the "" cells since there is no number in them, and is returning #VALUE in CZ4 and DA4 because of this. I assume the attached sheet uploaded with formulas intact so you can see the weekly totals formulas as well as how they respond in activated weeks and non-activated weeks.

In the attached example, only weeks 1 and 2 are activated, so the summations in CZ4 and DA4 should be for only those two weeks, ignoring weeks 3 through 12. As each successive week is activated, then the summations in CZ4 and DA4 should sum considering the designated totals cells in rows 35 and 36 for those weeks as they are activated across time.

I have tried constructing the SUMIFS formula to handle this, but I cannot get it to work. However, I am not even sure if this is the right formula to use in this case. I could write a very long nested IF statement (perhaps too long for the maximum formula length) to do this, but there should be a more straight-forward way to do it using a conditional summation formula in Excel. I just do not know which one to use nor how to build it to meet the required criteria.

What should the formulas in cells CZ4 and DA4 be in order to get summations for only the activated weeks' totals?

Class-Attendance-and-Participati.xlsx