To sum Data1 (D2:D9
) based on the column of merged cells (B2:B9
) showing "Not Blue", and replacing the non-breaking spaces with spaces, you could try this:
=SUMPRODUCT((LOOKUP(ROW(B2:B9),ROW(B2:B9)/(B2:B9<>""),TRIM(SUBSTITUTE(B2:B9,CHAR(160)," ")))="Not Blue")*D2:D9)
The LOOKUP(.)
part of the formula evaluates to:
{"Blue";"Blue";"Blue";"Not Blue";"Not Blue";"Not Blue";"No Answer";"No Answer;"No Answer"}
Additional conditions can be added for other columns of merged cells by replicating this part of the formula and changing the references. For example, you could use this approach to find Data1+Data2+ Data3 for the conditions (Level 1,Not Blue, Red):
=SUMPRODUCT((LOOKUP(.)="Level1")*(LOOKUP(.)="Not Blue")*(C2:C9="Red")*D2:F9)
where (LOOKUP(.)="Not Blue")
is contained in the first formula above
and (LOOKUP(.)="Level1")
is the same but with A2:A9
in place of B2:B9
.