Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Sumproduct - visible cells

Hi,

I trying to to use sumproduct only on visible cells and having a hard
time. I read through many help sites, but can't seem to get it to
work. Here's what I'm trying to do to a much larger file...

A B
1 2 300
2 2 200 (hidden/filtered)
3 3 100

How do I set up a formula to get 2*300 + 3*100 = 900?

Thanks.

tinman

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Sumproduct - visible cells

One way is to do the multiplication in another column, say column C. So you
get

A B C
1 2 300 600
2 2 200 400 (hidden/filtered)
3 3 100 100


Then, SUM all visible rows in column C by using SUBTOTAL.

=SUBTOTAL(109, C1:C3)



" wrote:

Hi,

I trying to to use sumproduct only on visible cells and having a hard
time. I read through many help sites, but can't seem to get it to
work. Here's what I'm trying to do to a much larger file...

A B
1 2 300
2 2 200 (hidden/filtered)
3 3 100

How do I set up a formula to get 2*300 + 3*100 = 900?

Thanks.

tinman


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Sumproduct - visible cells

I have several pairs of columns that i need to do this to and was
hoping to not have to add several "total" columns.

tinman

On Feb 27, 3:30 pm, Vergel Adriano
wrote:
One way is to do the multiplication in another column, say column C. So you
get

A B C
1 2 300 600
2 2 200 400 (hidden/filtered)
3 3 100 100

Then, SUM all visible rows in column C by using SUBTOTAL.

=SUBTOTAL(109, C1:C3)

" wrote:
Hi,


I trying to to use sumproduct only on visible cells and having a hard
time. I read through many help sites, but can't seem to get it to
work. Here's what I'm trying to do to a much larger file...


A B
1 2 300
2 2 200 (hidden/filtered)
3 3 100


How do I set up a formula to get 2*300 + 3*100 = 900?


Thanks.


tinman



  #4   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Sumproduct - visible cells

A second approach would be to implement this custom function:

Function vis_SumProduct(input1 As Range, input2 As Range)
For Each cl In input1.Cells
If cl.EntireRow.Hidden = False Then
Product = cl * cl.Offset(0, Abs(input2.Column - input1.Column))
vis_SumProduct = vis_SumProduct + Product
End If
Next 'cl
End Function

--
Jay


"Vergel Adriano" wrote:

One way is to do the multiplication in another column, say column C. So you
get

A B C
1 2 300 600
2 2 200 400 (hidden/filtered)
3 3 100 100


Then, SUM all visible rows in column C by using SUBTOTAL.

=SUBTOTAL(109, C1:C3)



" wrote:

Hi,

I trying to to use sumproduct only on visible cells and having a hard
time. I read through many help sites, but can't seem to get it to
work. Here's what I'm trying to do to a much larger file...

A B
1 2 300
2 2 200 (hidden/filtered)
3 3 100

How do I set up a formula to get 2*300 + 3*100 = 900?

Thanks.

tinman


  #5   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Sumproduct - visible cells

Hi tinman -

Here is an updated version. It simply removes the Abs function from one
line; it's more universal.

Function vis_SumProduct(input1 As Range, input2 As Range)
For Each cl In input1.Cells
If cl.EntireRow.Hidden = False Then
Product = cl * cl.Offset(0, input2.Column - input1.Column)
vis_SumProduct = vis_SumProduct + Product
End If
Next 'cl
End Function

--
Jay


" wrote:

I have several pairs of columns that i need to do this to and was
hoping to not have to add several "total" columns.

tinman

On Feb 27, 3:30 pm, Vergel Adriano
wrote:
One way is to do the multiplication in another column, say column C. So you
get

A B C
1 2 300 600
2 2 200 400 (hidden/filtered)
3 3 100 100

Then, SUM all visible rows in column C by using SUBTOTAL.

=SUBTOTAL(109, C1:C3)

" wrote:
Hi,


I trying to to use sumproduct only on visible cells and having a hard
time. I read through many help sites, but can't seem to get it to
work. Here's what I'm trying to do to a much larger file...


A B
1 2 300
2 2 200 (hidden/filtered)
3 3 100


How do I set up a formula to get 2*300 + 3*100 = 900?


Thanks.


tinman




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
Copy Visible Cells in Sheet with Merged and Hidden Cells rtwiss Excel Discussion (Misc queries) 5 April 25th 23 09:08 AM
summing visible cells using SUMIF/SUMPRODUCT not SUBTOTAL EricBB Excel Discussion (Misc queries) 1 December 24th 08 09:02 AM
sumproduct and visible cells Lee Excel Worksheet Functions 0 June 21st 07 03:36 PM
SUMPRODUCT TO CALCULATE VISIBLE CELLS ONLY Lisa Excel Worksheet Functions 4 January 11th 05 12:58 PM
Help: Copying Visible Cells only to Visible cells! Jay Jayakumar Excel Programming 0 July 9th 03 08:25 PM


All times are GMT +1. The time now is 01:11 PM.

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"