excelize icon indicating copy to clipboard operation
excelize copied to clipboard

How to add subtotals to a sheet?

Open tfonfara opened this issue 3 years ago • 2 comments

Is there any way to add subtotals to a sheet?

Excel-table-05

SetRowOutlineLevel doesn't seem to help as it doesn't create the subtotals.

Thank you!

tfonfara avatar Mar 14 '21 17:03 tfonfara

Thanks for your issue. SetRowOutlineLevel just group rows, and you can use SetCellFormula to set SUBTOTAL formula for the cell.

xuri avatar Mar 15 '21 03:03 xuri

Actually the "subtotal" method in excel does automatically grouping that can be removed or adjusted very easy. If I use SetCellFormula this means that (1) I have to do all the calculations manually, also the grouping and the summarization and (2) that this is "hardcoded" in the table, it can't be switched off or modified in any way (which is a big benefit of the original subtotal feature).

Maybe to be precise, I'm not referring to the subtotal function, instead I'm talking about the subtotal command.

tfonfara avatar Mar 15 '21 10:03 tfonfara