Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
djarcadian
 
Posts: n/a
Default removing hidden fields from equation?


I have a simple equation like =SUM(F1:F28) but how can I prevent hidden
cells from being added?


--
djarcadian
------------------------------------------------------------------------
djarcadian's Profile: http://www.excelforum.com/member.php...o&userid=15877
View this thread: http://www.excelforum.com/showthread...hreadid=535727

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default removing hidden fields from equation?

If the row is hidden as the result of an autofilter, you could use:

=subtotal(9,f1:f28)

If you're using xl2003, you could use:
=subtotal(109,f1:f28)

And that will ignore hidden rows -- both filtered and manually hidden.

======
Or you could use a userdefined function:

Option Explicit
Function SumVisible(rng As Range) As Double

Application.Volatile True

Dim myCell As Range
Dim mySum As Double

mySum = 0
For Each myCell In rng.Cells
If myCell.RowHeight = 0 _
Or myCell.ColumnWidth = 0 Then
'do nothing
Else
If Application.IsNumber(myCell.Value) Then
mySum = mySum + myCell.Value
End If
End If
Next myCell

SumVisible = mySum

End Function

When I hid/unhid a column, the UDF didn't recalculate (xl2003). You may want to
force a recalc before you trust the results.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

djarcadian wrote:

I have a simple equation like =SUM(F1:F28) but how can I prevent hidden
cells from being added?

--
djarcadian
------------------------------------------------------------------------
djarcadian's Profile: http://www.excelforum.com/member.php...o&userid=15877
View this thread: http://www.excelforum.com/showthread...hreadid=535727


--

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
Removing The N/A from showing in open fields Killer Excel Worksheet Functions 5 April 23rd 06 11:08 PM
removing leading zeros in numeric fields dingy101 Excel Discussion (Misc queries) 3 November 21st 05 03:46 AM
removing digit or calc LEN fields tri_p Excel Worksheet Functions 3 October 4th 05 06:02 AM
Copy without Hidden Cols - How abrogard Excel Discussion (Misc queries) 1 July 15th 05 07:54 AM
Removing Hidden But Keep Values Wayne Excel Discussion (Misc queries) 2 December 11th 04 02:05 AM


All times are GMT +1. The time now is 08:06 AM.

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

About Us

"It's about Microsoft Excel"