XL: Formula for Cumulative Category Total

Last reviewed: February 3, 1998
Article ID: Q150362

The information in this article applies to:
  • Microsoft Excel for the Macintosh, versions 5.0, 5.0a
  • Microsoft Excel 98 Macintosh Edition
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for Windows 95, version 7.0
  • Microsoft Excel 97 for Windows

SUMMARY

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

MORE INFORMATION

If you have a column of categories and a column of values, then 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 in column A, and the values column is in column B, and the headers are on row 1, the running category total formula at the top row would be:

   =SUMIF(INDIRECT("A2:A"&ROW()),"="&A2,INDIRECT("B2:B"&ROW()))

Copy the formula down for all rows used.

For more information about the SUMIF formula, click the Search button in Help and type

   SUMIF function

For more information about the INDIRECT formula, click the Search button in Help and type

   INDIRECT function


Additional query words: 5.00 5.00a 5.00c 5.0 5.0c 7.00 running total
Keywords : kbprg
Version : WINDOWS: 5.0, 5.0c, 7.0, 97; MACINTOSH: 5.0, 5.0a, 98
Platform : MACINTOSH WINDOWS
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 3, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.