Subtotal function with Criteria

D

Dilip Mistry

Hi

Has anyone created a macro that uses the functionality of the SUBTOTAL with
the functionality of the SUMIF.

I am trying to sum only visible cells using a selection criteria.

Thanks in Advance
 
F

Frank Kabel

Hi
try the following:
=SUMPRODUCT(--(SUBTOTAL(3,OFFSET(INDEX($A$1:$A$10,1,1),ROW($A$1:$A$10)-
ROW(INDEX($A$1:$A$10,1,1)),0))=1),--($A$1:$A$10="lookup_value"),$B$1:$B
$10)

looks for the value 'lookup_value' in column A and sums the
corresponding value in column B
 
A

Aladin Akyurek

Invoking the Longre idiom...

=SUMPRODUCT(SUBTOTAL(9,OFFSET(C$4:C$30,ROW(C$4:C$30)-MIN(ROW(C$4:C$30)),,1)),--($B$4:$B$30=$A2))

where C4:C30 is the range to sum and B4:B10 the range for which A2 (th
condition) must hold.

Note. 9 instead of 3 in the SUBTOTAL(...) bit is due (in a post a
MrExcel) to Domenic.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SUBTOTAL in SUMIF formula 7
Subtotal Formatting 2
Subtotal function 7
subtotal with sumif nested 1
Subtotal function 2
subtotal function using criteria 5
Subtotal by VBA 5
Copy Certain Values 1

Top