Forum Discussion

Caser29's avatar
Caser29
Copper Contributor
Apr 10, 2026
Solved

Help Clean Up This Formula

Hello, I am looking for a way to compact this formula more. I have about 20 rows I need to do.  =C25-IF(OR(COUNTIF(D3,{"A","B","C"})),C3,0)-IF(OR(COUNTIF(D4,{"A","B","C"})),C4,0)-IF(OR(COUNTIF(...
  • Olufemi7's avatar
    Apr 11, 2026

    Hello Caser29​,

    Use a single SUMIF instead of multiple IF statements.

    Formula:
    C25-SUM(SUMIF(D3:D24,{"A","B","C"},C3:C24))

    This subtracts all values in C3:C24 where D3:D24 equals A, B, or C.

    For newer Excel (365 / dynamic arrays), you can also use:
    C25-SUM(FILTER(C3:C24,ISNUMBER(MATCH(D3:D24,{"A","B","C"},0))))

    This filters the matching rows first, sums them, and subtracts from C25.