Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 59
Default Sum visible cells only

Hi

Is there a way to sum visible cells only without using a pivot table? Some
values are sitting in hidden columns and they still add up, I'd like them to
be ignored

Thanks

Diane
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Sum visible cells only

Add this UDF

'--------------------------------------------------------------------------
Function IsVisible(ByVal rng As Range)
'--------------------------------------------------------------------------
Dim oRange As Range
Dim i As Long
Dim ary()

If rng.Rows.Count 1 And _
rng.Columns.Count 1 Then
IsVisible = CVErr(xlErrRef)
Else
If rng.Rows.Count rng.Columns.Count Then
ReDim ary(1 To 1, 1 To rng.Rows.Count)
For Each oRange In rng.Rows
i = i + 1
ary(1, i) = Not oRange.EntireRow.Hidden
Next oRange
IsVisible = Application.Transpose(ary)
Else
ReDim ary(1 To 1, 1 To rng.Columns.Count)
For Each oRange In rng.Columns
i = i + 1
ary(1, i) = Not oRange.EntireColumn.Hidden
Next oRange
IsVisible = ary
End If
End If
End Function


and use like so

=SUMPRODUCT(--(isvisible(D2:D7)),D2:D7)

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"DianeG" wrote in message
...
Hi

Is there a way to sum visible cells only without using a pivot table?
Some
values are sitting in hidden columns and they still add up, I'd like them
to
be ignored

Thanks

Diane



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 59
Default Sum visible cells only

Thanks very much Bob, do you know if is this the only way you can do it? I
know the guy who needs it doesn't know VBA

Regards

Diane

"Bob Phillips" wrote:

Add this UDF

'--------------------------------------------------------------------------
Function IsVisible(ByVal rng As Range)
'--------------------------------------------------------------------------
Dim oRange As Range
Dim i As Long
Dim ary()

If rng.Rows.Count 1 And _
rng.Columns.Count 1 Then
IsVisible = CVErr(xlErrRef)
Else
If rng.Rows.Count rng.Columns.Count Then
ReDim ary(1 To 1, 1 To rng.Rows.Count)
For Each oRange In rng.Rows
i = i + 1
ary(1, i) = Not oRange.EntireRow.Hidden
Next oRange
IsVisible = Application.Transpose(ary)
Else
ReDim ary(1 To 1, 1 To rng.Columns.Count)
For Each oRange In rng.Columns
i = i + 1
ary(1, i) = Not oRange.EntireColumn.Hidden
Next oRange
IsVisible = ary
End If
End If
End Function


and use like so

=SUMPRODUCT(--(isvisible(D2:D7)),D2:D7)

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"DianeG" wrote in message
...
Hi

Is there a way to sum visible cells only without using a pivot table?
Some
values are sitting in hidden columns and they still add up, I'd like them
to
be ignored

Thanks

Diane




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Sum visible cells only

I think so.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"DianeG" wrote in message
...
Thanks very much Bob, do you know if is this the only way you can do it?
I
know the guy who needs it doesn't know VBA

Regards

Diane

"Bob Phillips" wrote:

Add this UDF

'--------------------------------------------------------------------------
Function IsVisible(ByVal rng As Range)
'--------------------------------------------------------------------------
Dim oRange As Range
Dim i As Long
Dim ary()

If rng.Rows.Count 1 And _
rng.Columns.Count 1 Then
IsVisible = CVErr(xlErrRef)
Else
If rng.Rows.Count rng.Columns.Count Then
ReDim ary(1 To 1, 1 To rng.Rows.Count)
For Each oRange In rng.Rows
i = i + 1
ary(1, i) = Not oRange.EntireRow.Hidden
Next oRange
IsVisible = Application.Transpose(ary)
Else
ReDim ary(1 To 1, 1 To rng.Columns.Count)
For Each oRange In rng.Columns
i = i + 1
ary(1, i) = Not oRange.EntireColumn.Hidden
Next oRange
IsVisible = ary
End If
End If
End Function


and use like so

=SUMPRODUCT(--(isvisible(D2:D7)),D2:D7)

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"DianeG" wrote in message
...
Hi

Is there a way to sum visible cells only without using a pivot table?
Some
values are sitting in hidden columns and they still add up, I'd like
them
to
be ignored

Thanks

Diane






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default Sum visible cells only

Have you tried:

=SUBTOTAL(109,range)

?

Hope this helps.

Pete

On Mar 5, 7:00*pm, DianeG wrote:
Thanks very much Bob, do you know if is this the only way you can do it? *I
know the guy who needs it doesn't know VBA

Regards

Diane



"Bob Phillips" wrote:
Add this UDF


'--------------------------------------------------------------------------
Function IsVisible(ByVal rng As Range)
'--------------------------------------------------------------------------
Dim oRange As Range
Dim i As Long
Dim ary()


* * If rng.Rows.Count 1 And _
* * * * rng.Columns.Count 1 Then
* * * * IsVisible = CVErr(xlErrRef)
* * Else
* * * * If rng.Rows.Count rng.Columns.Count Then
* * * * * * ReDim ary(1 To 1, 1 To rng.Rows.Count)
* * * * * * For Each oRange In rng.Rows
* * * * * * * * i = i + 1
* * * * * * * * ary(1, i) = Not oRange.EntireRow.Hidden
* * * * * * Next oRange
* * * * * * IsVisible = Application.Transpose(ary)
* * * * Else
* * * * * * ReDim ary(1 To 1, 1 To rng.Columns.Count)
* * * * * * For Each oRange In rng.Columns
* * * * * * * * i = i + 1
* * * * * * * * ary(1, i) = Not oRange.EntireColumn.Hidden
* * * * * * Next oRange
* * * * * * IsVisible = ary
* * * * End If
* * End If
End Function


and use like so


=SUMPRODUCT(--(isvisible(D2:D7)),D2:D7)


--
---
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)


"DianeG" wrote in message
...
Hi


Is there a way to sum visible cells only without using a pivot table?
Some
values are sitting in hidden columns and they still add up, I'd like them
to
be ignored


Thanks


Diane- Hide quoted text -


- Show quoted text -




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Sum visible cells only

It is hidden columns Pete.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Pete_UK" wrote in message
...
Have you tried:

=SUBTOTAL(109,range)

?

Hope this helps.

Pete

On Mar 5, 7:00 pm, DianeG wrote:
Thanks very much Bob, do you know if is this the only way you can do it? I
know the guy who needs it doesn't know VBA

Regards

Diane



"Bob Phillips" wrote:
Add this UDF


'--------------------------------------------------------------------------
Function IsVisible(ByVal rng As Range)
'--------------------------------------------------------------------------
Dim oRange As Range
Dim i As Long
Dim ary()


If rng.Rows.Count 1 And _
rng.Columns.Count 1 Then
IsVisible = CVErr(xlErrRef)
Else
If rng.Rows.Count rng.Columns.Count Then
ReDim ary(1 To 1, 1 To rng.Rows.Count)
For Each oRange In rng.Rows
i = i + 1
ary(1, i) = Not oRange.EntireRow.Hidden
Next oRange
IsVisible = Application.Transpose(ary)
Else
ReDim ary(1 To 1, 1 To rng.Columns.Count)
For Each oRange In rng.Columns
i = i + 1
ary(1, i) = Not oRange.EntireColumn.Hidden
Next oRange
IsVisible = ary
End If
End If
End Function


and use like so


=SUMPRODUCT(--(isvisible(D2:D7)),D2:D7)


--
---
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)


"DianeG" wrote in message
...
Hi


Is there a way to sum visible cells only without using a pivot table?
Some
values are sitting in hidden columns and they still add up, I'd like
them
to
be ignored


Thanks


Diane- Hide quoted text -


- Show quoted text -



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default Sum visible cells only

Yes, I realised that after re-reading the post - I should pay more
attention !! <bg

It does seem to crop up fairly often, though, so perhaps Microsoft may
get SUBTOTAL to work in this way for columns as well as rows some time
in the future (after pigs learn to fly !!)

Pete

On Mar 5, 10:36*pm, "Bob Phillips" wrote:
It is hidden columns Pete.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Pete_UK" wrote in message

...
Have you tried:

=SUBTOTAL(109,range)

?

Hope this helps.

Pete

On Mar 5, 7:00 pm, DianeG wrote:



Thanks very much Bob, do you know if is this the only way you can do it? I
know the guy who needs it doesn't know VBA


Regards


Diane


"Bob Phillips" wrote:
Add this UDF


'--------------------------------------------------------------------------
Function IsVisible(ByVal rng As Range)
'--------------------------------------------------------------------------
Dim oRange As Range
Dim i As Long
Dim ary()


If rng.Rows.Count 1 And _
rng.Columns.Count 1 Then
IsVisible = CVErr(xlErrRef)
Else
If rng.Rows.Count rng.Columns.Count Then
ReDim ary(1 To 1, 1 To rng.Rows.Count)
For Each oRange In rng.Rows
i = i + 1
ary(1, i) = Not oRange.EntireRow.Hidden
Next oRange
IsVisible = Application.Transpose(ary)
Else
ReDim ary(1 To 1, 1 To rng.Columns.Count)
For Each oRange In rng.Columns
i = i + 1
ary(1, i) = Not oRange.EntireColumn.Hidden
Next oRange
IsVisible = ary
End If
End If
End Function


and use like so


=SUMPRODUCT(--(isvisible(D2:D7)),D2:D7)


--
---
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)


"DianeG" wrote in message
...
Hi


Is there a way to sum visible cells only without using a pivot table?
Some
values are sitting in hidden columns and they still add up, I'd like
them
to
be ignored


Thanks


Diane- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Sum visible cells only

There seems to be an aversion to making good facilities even better, and
SUBTOTAL is a goodie IMO, too much emphasis on visual appeal (or not).

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Pete_UK" wrote in message
...
Yes, I realised that after re-reading the post - I should pay more
attention !! <bg

It does seem to crop up fairly often, though, so perhaps Microsoft may
get SUBTOTAL to work in this way for columns as well as rows some time
in the future (after pigs learn to fly !!)

Pete

On Mar 5, 10:36 pm, "Bob Phillips" wrote:
It is hidden columns Pete.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Pete_UK" wrote in message

...
Have you tried:

=SUBTOTAL(109,range)

?

Hope this helps.

Pete

On Mar 5, 7:00 pm, DianeG wrote:



Thanks very much Bob, do you know if is this the only way you can do it?
I
know the guy who needs it doesn't know VBA


Regards


Diane


"Bob Phillips" wrote:
Add this UDF


'--------------------------------------------------------------------------
Function IsVisible(ByVal rng As Range)
'--------------------------------------------------------------------------
Dim oRange As Range
Dim i As Long
Dim ary()


If rng.Rows.Count 1 And _
rng.Columns.Count 1 Then
IsVisible = CVErr(xlErrRef)
Else
If rng.Rows.Count rng.Columns.Count Then
ReDim ary(1 To 1, 1 To rng.Rows.Count)
For Each oRange In rng.Rows
i = i + 1
ary(1, i) = Not oRange.EntireRow.Hidden
Next oRange
IsVisible = Application.Transpose(ary)
Else
ReDim ary(1 To 1, 1 To rng.Columns.Count)
For Each oRange In rng.Columns
i = i + 1
ary(1, i) = Not oRange.EntireColumn.Hidden
Next oRange
IsVisible = ary
End If
End If
End Function


and use like so


=SUMPRODUCT(--(isvisible(D2:D7)),D2:D7)


--
---
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)


"DianeG" wrote in message
...
Hi


Is there a way to sum visible cells only without using a pivot
table?
Some
values are sitting in hidden columns and they still add up, I'd like
them
to
be ignored


Thanks


Diane- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 59
Default Sum visible cells only

thanks guys

"Bob Phillips" wrote:

There seems to be an aversion to making good facilities even better, and
SUBTOTAL is a goodie IMO, too much emphasis on visual appeal (or not).

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Pete_UK" wrote in message
...
Yes, I realised that after re-reading the post - I should pay more
attention !! <bg

It does seem to crop up fairly often, though, so perhaps Microsoft may
get SUBTOTAL to work in this way for columns as well as rows some time
in the future (after pigs learn to fly !!)

Pete

On Mar 5, 10:36 pm, "Bob Phillips" wrote:
It is hidden columns Pete.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Pete_UK" wrote in message

...
Have you tried:

=SUBTOTAL(109,range)

?

Hope this helps.

Pete

On Mar 5, 7:00 pm, DianeG wrote:



Thanks very much Bob, do you know if is this the only way you can do it?
I
know the guy who needs it doesn't know VBA


Regards


Diane


"Bob Phillips" wrote:
Add this UDF


'--------------------------------------------------------------------------
Function IsVisible(ByVal rng As Range)
'--------------------------------------------------------------------------
Dim oRange As Range
Dim i As Long
Dim ary()


If rng.Rows.Count 1 And _
rng.Columns.Count 1 Then
IsVisible = CVErr(xlErrRef)
Else
If rng.Rows.Count rng.Columns.Count Then
ReDim ary(1 To 1, 1 To rng.Rows.Count)
For Each oRange In rng.Rows
i = i + 1
ary(1, i) = Not oRange.EntireRow.Hidden
Next oRange
IsVisible = Application.Transpose(ary)
Else
ReDim ary(1 To 1, 1 To rng.Columns.Count)
For Each oRange In rng.Columns
i = i + 1
ary(1, i) = Not oRange.EntireColumn.Hidden
Next oRange
IsVisible = ary
End If
End If
End Function


and use like so


=SUMPRODUCT(--(isvisible(D2:D7)),D2:D7)


--
---
HTH


Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)


"DianeG" wrote in message
...
Hi


Is there a way to sum visible cells only without using a pivot
table?
Some
values are sitting in hidden columns and they still add up, I'd like
them
to
be ignored


Thanks


Diane- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -




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
Sum Visible Cells Julie Excel Worksheet Functions 5 February 26th 08 12:31 AM
Sum of visible cells only Stgeorge Excel Worksheet Functions 11 August 23rd 06 04:58 PM
sum only visible cells hommer Excel Worksheet Functions 5 May 11th 06 11:39 PM
Visible Cells Only! Don Excel Worksheet Functions 2 May 2nd 05 09:48 PM
can i sum up only visible cells? Wink Excel Worksheet Functions 2 April 1st 05 07:10 PM


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