Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
PO
 
Posts: n/a
Default Help with SUBTOTAL formula

Hello,

I want to sum the values in column A if the corresponding values in column B
are greater then or equal to 0.
In the example below the formula should return 120:

ColA ColB ColC
100 -3 Cats
50 1 Dogs
70 2 Cats

The problem is that the table uses an autofilter and, if the table is
filtered, the formula should only sum the visible rows (still using the
condition mentioned above). If, for instance, the table is filtered on
"Cats" the formula should return 70.

The only formula I know that reacts to autofilter is the SUBTOTAL formula
but, as far as I know, I can't use conditions in the SUBTOTAL formula.

Any ideas?

Regards
PO


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Roger Govier
 
Posts: n/a
Default Help with SUBTOTAL formula

Hi

Without using the Autofilter, you could use
=SUMPRODUCT(--($B$1:$B$1000),--($C$1:$C$100="Cats"),$A$1:$A$100)

If you put Cats or Dogs in cell D1, then change formula to
=SUMPRODUCT(--($B$1:$B$1000),--($C$1:$C$100=D1),$A$1:$A$100)

then just change the value in D1 as appropriate.
Change size of ranges to suit, but do ensure that they are all of equal
length, and note that Sumproduct cannot take whole columns B:B as its
arguments.

--
Regards

Roger Govier


"PO" <h wrote in message ...
Hello,

I want to sum the values in column A if the corresponding values in
column B are greater then or equal to 0.
In the example below the formula should return 120:

ColA ColB ColC
100 -3 Cats
50 1 Dogs
70 2 Cats

The problem is that the table uses an autofilter and, if the table is
filtered, the formula should only sum the visible rows (still using
the condition mentioned above). If, for instance, the table is
filtered on "Cats" the formula should return 70.

The only formula I know that reacts to autofilter is the SUBTOTAL
formula but, as far as I know, I can't use conditions in the SUBTOTAL
formula.

Any ideas?

Regards
PO



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
Need a simple subtotal Formula tx12345 Excel Worksheet Functions 2 January 26th 06 07:07 PM
2 Nesting questions Starchaser Excel Worksheet Functions 7 January 20th 06 06:53 PM
pivot table : formula to absolute reference a subtotal fax Excel Discussion (Misc queries) 2 November 19th 05 09:28 PM
Nested Subtotal Formula nickimu Excel Worksheet Functions 1 August 30th 05 04:21 PM
Creating a check mark box MarthaSue Setting up and Configuration of Excel 18 April 28th 05 12:31 AM


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