I suggesting to create helper row such as E12 - S12
=CELL("Width",E4)
put this code in every single column and hide entire row
Then in in sum cell, let's say T4 write this code
=SUMIF($E$12:$S$12,">0",E4:S4)
The only problem with this formula is, that particular event "Hide", "Unhide" Is not registered as event and sum cells are not recalculated. This could be fixed with VBA and UIeditor.
You will need UIeditor to add custom ribbons for your sheet to catch this specific event such as hide / unhide columns to do that you need editor downloadable here: http://www.rondebruin.nl/win/s2/win001.htm
Then add this code for your sheet:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" >
<commands >
<command
idMso="ColumnsHide"
onAction="Column_Hide_Macro"/>
<command
idMso="ColumnsUnhide"
onAction="Column_UnHide_Macro"/>
</commands >
So now when someone hit hide or unhide column macros "Column_Hide_Macro" or "Column_UnHide_Macro" are activated
Then add into your spreadsheet this
Sub column_hide_Macro(control As IRibbonControl, ByRef cancelDefault)
cancelDefault = False
alertTime = Now + TimeSerial(0, 0, 0.1)
Application.OnTime alertTime, "reCalc"
End Sub
Sub column_unhide_Macro(control As IRibbonControl, ByRef cancelDefault)
cancelDefault = False
alertTime = Now + TimeSerial(0, 0, 0.1)
Application.OnTime alertTime, "reCalc"
End Sub
Sub reCalc()
Application.CalculateFullRebuild
End Sub
Add this code into the module not sheet or workbook code!
Now you should get sheet recalculated every single time when you hide or unhide column.
Cheers...