Search code examples
excelexcel-formulaexcel-2007formulasubtotal

Sum Only Visible Cells


I have data in Cells B2:ZZ2 and I am hiding several of the cells. I want a way to SUM() the data in the visible cells only. I have tried SUM() and SUBTOTAL(109) however, I am not getting the sum I am after. If you take a look at image 1, it shows I get all 0 returned from my formula. And I show my formula in the address bar. Image 2 shows my desired output. What formula can I use to get my desired ouput?

Image1

Image2


Solution

  • It sounds like the "numbers" you want to sum may actually be text, which Excel does not see as numbers and you will get 0. Try running a text to columns on the cells containing the data, even though there is nothing to split to another column. Also, subtotal only excludes hidden rows for some reason, not columns. I am not sure why they designed it that way, but they did. I found some VBA to create a customer UDF, here: link if that helps you at all.