Home > Enterprise >  In Excel, is there a way to sum B2 to B6 and place it in B7, B8 to B12 and place it in B13 and so on
In Excel, is there a way to sum B2 to B6 and place it in B7, B8 to B12 and place it in B13 and so on

Time:01-19

Trying to sum values of all keys (that are unique) and place it in the below that column

sample

Something like this

expected

CodePudding user response:

Exel has built-in functionality for this, called "Outline". It is in the data ribbon.

Select a cell in the data, then click Data ribbon > Outline > Subtotal. You can then specify which columns you want to calculated totals for. In this example, you want to total columns titled "b" and "c" at each change in column titled "a".

enter image description here

After confirming the dialog, the result looks like this. You can see that Excel uses the Subtotal function to calculate the subtotals.

enter image description here

If you need to add more data, you can insert rows in the appropriate places, or, remove the Outline, add more data to the bottom of the list, sort by "a" and re-do the Outline.

Note: It is often better to keep data and reporting on data (the totals calculations) separate. Consider using a pivot table to create an overview of totals b and c per category a. Once set up, you can add more data in any order to your source table and just refresh the pivot table. Or use Sumifs() formulas to build a calculation table outside of your data entry table.

  • Related