Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Summing only #'s on unhidden columns

Assume cells B1, C1 and D1 have 5's in them and that I hide column C. I am
trying to figure out how to sum B1:d1 and get the answer 10. When I try to
use the =subtotal(109,b1:d1) function it returns the answer 15.

Subtotal(109,x:y) works to add only shown rows but it doesn't seem to work
on column sums.

Does anybody have a suggestion.

Thanks

Peter
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Summing only #'s on unhidden columns


For columns you need a new function. This USER-DEFINED FUNCTION should
do the trick:


Code:
--------------------
Function VisTotal(Rg As Range)
Dim x, tot
Application.Volatile
tot = 0
For Each x In Rg
If x.ColumnWidth = 0 Or x.RowHeight = 0 Then Else tot = tot + x
Next
VisTotal = tot
End Function
--------------------


Insert that code into a MODULE, then use the formula simply:

=VisTotal(A1:M1)

...and only the visible cells across those columns would sum. Adjust
accordingly.


--
JBeaucaire
------------------------------------------------------------------------
JBeaucaire's Profile: http://www.thecodecage.com/forumz/member.php?userid=73
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=46479

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Summing only #'s on unhidden columns



Peter Trumbo wrote:

Assume cells B1, C1 and D1 have 5's in them and that I hide column C. I am
trying to figure out how to sum B1:d1 and get the answer 10. When I try to
use the =subtotal(109,b1:d1) function it returns the answer 15.

Subtotal(109,x:y) works to add only shown rows but it doesn't seem to work
on column sums.

Does anybody have a suggestion.

Thanks

Peter


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Summing only #'s on unhidden columns

If the hidden/visible columns don't change (or don't change very often), you may
want to consider using an indicator row (manually updated).

You could put an x in row 1 in each column that should be visible (and hide row
1).

Then use a formula like:
=sumif($1$1,"x",2:2)
or
=sumif($b$1:$d$1,"x",$b2:$d2)



Peter Trumbo wrote:

Assume cells B1, C1 and D1 have 5's in them and that I hide column C. I am
trying to figure out how to sum B1:d1 and get the answer 10. When I try to
use the =subtotal(109,b1:d1) function it returns the answer 15.

Subtotal(109,x:y) works to add only shown rows but it doesn't seem to work
on column sums.

Does anybody have a suggestion.

Thanks

Peter


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Summing columns [email protected] Excel Discussion (Misc queries) 1 March 15th 07 03:27 PM
summing columns thedarkman Excel Worksheet Functions 1 January 2nd 06 07:42 PM
Summing Columns savv32 Excel Worksheet Functions 4 October 7th 05 01:59 AM
Not summing a columns? Nicole Excel Worksheet Functions 2 April 23rd 05 03:30 PM
Hidden Columns are unhidden when inserting a Formula Andy Excel Discussion (Misc queries) 0 April 4th 05 08:16 PM


All times are GMT +1. The time now is 05:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"