Hi,
I maintain a budget document and one sheet in the workbook displays Budget, Actual, and Difference values for each month. The last three columns show YTD sums for Budget, Actual, and Difference. (See the image for help visualizing.)
My predecessor apparently would essentially start from scratch for each month's totals, using simple SUM formulas in the YTD that she updated at the end of each month. I stubbornly (perhaps too much) believe that there is a better way to do this, in which I can build formulas for every column in every month that reference Budget and Actual sheets, so the numbers feed in automatically (which I have done already); then, for the YTD section, I insert a formula that adds up only the visible cells (as you can see, I have each month grouped so I can hide the future months). The end result would be a dream world in which I plug numbers into the Actual column, hide the months I don't want to total, and the YTD section reflects the correct totals.
I've searched around for SumVisible VBA macros, which do half of the job for me. The problem is that I'm trying to sum non-sequential cells (Budget+Budget, Actual+Actual, etc), so the usual SumVisible(range) setup doesn't work. I've tested it by CTRL-clicking only the cells I want to sum, for example SumVisible(A1,C1,E1), and that returns a VALUE error. I have no prior experience with excel macros, but I do know a little about programming logic so I tried to tinker with the macro to make it do what I want. With the following setup, it no longer returns an error...rather, it only returns a value of 0. Any help on making this work would be appreciated.
sheet image.pngHTML Code:
Bookmarks