Forum Discussion

Aureanne's avatar
Aureanne
Copper Contributor
May 01, 2019

Formula SUMIF - mistake

Hi,

 

I used the formula SUMIF and found a mistake on my formula.

=SUMIF(K3:K371;"A";J2:J371) instead of =SUMIF(K3:K371;"A";J3:J371).

After corrected the formula, I had a different total amount.

Could you please explain to me where does the variance come from knowing that the cell J2 there is only a text ("total")?

 

Thank you and best regards,

9 Replies

  • Twifoo's avatar
    Twifoo
    Silver Contributor
    SUMIF requires that both range and sum_range arguments must always be equal in size and shape; otherwise, Excel coerces the sorter argument to conform to the longer one. When that happens, the result may be different from what you have expected.
    My simple advice is that don’t coerce Excel to make your formula conform to its syntax. Rather, always ensure that you conform to Excel’s syntax.
    • SergeiBaklan's avatar
      SergeiBaklan
      Diamond Contributor

      Twifoo , SUMIF doesn't require what ranges have to be the same size, they could be different. Another story is what as a rule better to use same size ranges.

      • Twifoo's avatar
        Twifoo
        Silver Contributor
        Excel insists, and so requires, both range and sum_range arguments to be equal. In the SUMIF syntax, just like law, the word “require” should be construed according to its spirit that gives life to, rather than according to its literal sense that kills, its true meaning.
  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Aureanne , other words it finds positions of the cells which meet criteria in criteria range and sum cells on the same positions starting from the beginning of the sum range. 

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Aureanne , second formula returns correct result. With first formula SUMIF shifts on one cell up with cells to sum. For example, if you have A in J5 and J7, SUMIFS returns K4+K6 in first case and K5+K7 for the correct formula.

Resources