Formula SUMIF - mistake

Copper Contributor

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

@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.

@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. 

@Sergei Baklan Thanks a lot!

@Aureanne , you are welcome

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.

@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.

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.
That’s exactly my emphasis earlier. I construed the word “require” according to its spirit that gives life to its true meaning. Apparently, you construed it according to its literal sense. I won’t insist how you construe it. That’s your prerogative and I respect it, although I won’t necessarily conform thereto.