Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jet Jet is offline
external usenet poster
 
Posts: 4
Default How do I get excel to sum a range without including hidden cells?

I need to sum a total dollar amount from a column in a spreadsheet. But I
need to hide certain rows after they are no longer needed. I don't want to
simply delete these as I may need to reference them later. The problem is the
running total I have always includes all the cells, hidden or not. I would
like the running total or SUM to not include the hidden rows. How can this be
done?
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default How do I get excel to sum a range without including hidden cells?

One caveat - Subtotal in earlier versions of XL doesn't exclude cells that
are hidden by the user, only those that are hidden using a filter. That
functionality was added in XL2002 or 2003 (so I've learned).

If that is the case, you have to use a UDF. Paste the function code below
into a VBA module. To use:
=SUMPRODUCT(--(isvisible(A1:A10)), A1:A10)


Function IsVisible(rngData As Range) As Variant
Dim arrTemp() As Variant
Dim i As Long
Dim t As Long

Application.Volatile True
With rngData
ReDim arrTemp(1 To .Rows.Count, _
1 To .Columns.Count)
For i = 1 To .Rows.Count
For t = 1 To .Columns.Count
arrTemp(i, t) = Not .Cells(i, t).EntireRow.Hidden And _
Not .Cells(i, t).EntireColumn.Hidden
Next t
Next i
End With

IsVisible = arrTemp
End Function


"Jet" wrote:

I need to sum a total dollar amount from a column in a spreadsheet. But I
need to hide certain rows after they are no longer needed. I don't want to
simply delete these as I may need to reference them later. The problem is the
running total I have always includes all the cells, hidden or not. I would
like the running total or SUM to not include the hidden rows. How can this be
done?

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
How do I not show certain Letters in a range of cells in excel? Taryn McGregor Excel Worksheet Functions 2 October 4th 06 09:49 PM
checking that cells have a value before the workbook will close kcdonaldson Excel Worksheet Functions 8 December 5th 05 04:57 PM
Help PLEASE! Not sure what answer is: Match? Index? Other? baz Excel Worksheet Functions 7 September 3rd 05 03:47 PM
Calculating without including Hidden Cells LiquidFire Excel Discussion (Misc queries) 3 November 29th 04 08:35 PM
How do I change an Excel range of cells from relative to absolute. Jrhenk Excel Worksheet Functions 2 November 15th 04 10:55 PM


All times are GMT +1. The time now is 02:01 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"