Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

XL2000: Formula for Cumulative Category Total


View products that this article applies to.

Summary

In Microsoft Excel 2000, if you have a column of categories and a column of values, you can calculate a running category total in a third column.

↑ Back to the top


More information

If you have a column of categories and a column of values, you can create a running category total, as in the following example:
   Categories      Values   Running category total
   -----------------------------------------------
   1               $4.00                     $4.00
   2               $8.00                     $8.00
   1               $5.00                     $9.00
   2               $7.00                    $15.00
   1               $5.00                    $14.00
   3               $4.00                     $4.00
   4               $3.00                     $3.00
   2               $5.00                    $20.00
   1               $7.00                    $21.00
   1               $7.00                    $28.00
   4               $5.00                     $8.00
   3               $5.00                     $9.00
   2               $5.00                    $25.00
   2               $6.00                    $31.00
   3               $5.00                    $14.00
   4               $6.00                    $14.00
   4               $7.00                    $21.00
   3               $4.00                    $18.00
   2               $6.00                    $37.00
   2               $7.00                    $44.00
   1               $6.00                    $34.00
   1               $6.00                    $40.00
   1               $4.00                    $44.00
   1               $6.00                    $50.00
   4               $5.00                    $26.00
   4               $5.00                    $31.00
   2               $6.00                    $50.00
   1               $6.00                    $56.00
   2               $3.00                    $53.00
				
Assuming that the category column is column A, the values column is column B, and the headings are in row 1, the running category total formula at the top row is:
=SUMIF(INDIRECT("A2:A"&ROW()),"="&A2,INDIRECT("B2:B"&ROW()))
Copy the formula for all rows used.

For more information about the SUMIF formula, click Microsoft Excel Help on the Help menu, type sumif worksheet function in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

For more information about the INDIRECT formula, click Microsoft Excel Help on the Help menu, type indirect worksheet function in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB214241, kbprogramming, kbinfo, kbhowto

↑ Back to the top

Article Info
Article ID : 214241
Revision : 4
Created on : 9/27/2003
Published on : 9/27/2003
Exists online : False
Views : 258