Log in

View Full Version : Sort a Column & sum the range with same value during the sort


Dulcie2009
Feb 23, 2009, 10:06 PM
Hi, I'm trying to sort a data table by Grades & then sum the totals of the cell with same Grade. The table consists of this headers: Date, DD#, Grade, Bags so what I'm trying to do is to come up with a formula that can sort by Grade & then add the total Bags against that particular Grade and display on the summary sheet.

Any help is greatly appreciated!

JBeaucaire
Feb 23, 2009, 10:16 PM
That's a SUMPRODUCT formula, or a SUMIF, either will work.

=SUMIF($C$2:$C$10,F2,$D$2:$D$10)
vs.
=SUMPRODUCT(--($C$2:$C$10=F2),$D$2:$D$10)

Given a choice, I would opt for the SUMIF since it is not volatile, like SUMPRODUCT.

But SUMPRODUCT can be fed additional filter criteria. For instance you could get all the As for a particular date by adding another section.

=SUMPRODUCT(--($C$2:$C$10=F2),--(B2:B10="DD1"),$D$2:$D$10)

(attachment with sample)

Dulcie2009
Feb 23, 2009, 10:28 PM
That's a SUMPRODUCT formula, or a SUMIF, either will work.

=SUMIF($C$2:$C$10,F2,$D$2:$D$10)
vs.
=SUMPRODUCT(--($C$2:$C$10=F2),$D$2:$D$10)

Given a choice, I would opt for the SUMIF since it is not volatile, like SUMPRODUCT.

But SUMPRODUCT can be fed additional filter criteria. For instance you could get all the As for a particular date by adding another section.

=SUMPRODUCT(--($C$2:$C$10=F2),--(B2:B10="DD1"),$D$2:$D$10)

(attachment with sample)

Thank you so much JBeaucaire! That is exactly what I needed...

Thanks