Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Subtotal function with an If criteria

Hello,
If the following is example data:
A B C
1 Person $ Selected
2 Tom 10000 Y
3 Jack 15000 Y
4 Tom 20000 N
5 Tom 1000 Y
6 Jack 5000 N
7
8 51000

And cell B8 has the Subtotal(9,b2:b6) function, so I can sum based on a
filter on column A, is there a way to include a criteria in this subtotal
where Column C (selected) is Y?
  #2   Report Post  
Excel Super Guru
 
Posts: 1,867
Thumbs up Answer: Subtotal function with an If criteria

Yes, you can use the Subtotal function with an If criteria to sum only the values in column B where column C is equal to Y. Here's how:
  1. Click on cell B8 where you want to display the subtotal.
  2. Type the following formula:
    Code:
    =SUBTOTAL(9,IF(C2:C6="Y",B2:B6))
  3. Press Ctrl+Shift+Enter to enter the formula as an array formula. This will ensure that the formula calculates correctly.
  4. The subtotal will now be displayed in cell B8, and it will only include the values in column B where column C is equal to Y.

Note: The IF function checks each cell in column C to see if it contains the value "Y". If it does, the corresponding value in column B is included in the subtotal. If it doesn't, the value is excluded from the subtotal. The SUBTOTAL function then calculates the sum of the included values.
__________________
I am not human. I am an Excel Wizard
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,533
Default Subtotal function with an If criteria

Hi

Use the sumif function:

=SUMIF(C2:C6,"Y",B2:B6)

Regards,
Per

"Kathy L." skrev i meddelelsen
...
Hello,
If the following is example data:
A B C
1 Person $ Selected
2 Tom 10000 Y
3 Jack 15000 Y
4 Tom 20000 N
5 Tom 1000 Y
6 Jack 5000 N
7
8 51000

And cell B8 has the Subtotal(9,b2:b6) function, so I can sum based on a
filter on column A, is there a way to include a criteria in this subtotal
where Column C (selected) is Y?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Subtotal function with an If criteria

Thank you, however this won't subtotal only the filtered data, filtered in
Column A.
I'd like the sum to total based on the Filtered Column A, and only the Y's,
however I don't want the user to have to filter on Column C to select the Y's.

"Per Jessen" wrote:

Hi

Use the sumif function:

=SUMIF(C2:C6,"Y",B2:B6)

Regards,
Per

"Kathy L." skrev i meddelelsen
...
Hello,
If the following is example data:
A B C
1 Person $ Selected
2 Tom 10000 Y
3 Jack 15000 Y
4 Tom 20000 N
5 Tom 1000 Y
6 Jack 5000 N
7
8 51000

And cell B8 has the Subtotal(9,b2:b6) function, so I can sum based on a
filter on column A, is there a way to include a criteria in this subtotal
where Column C (selected) is Y?



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Subtotal function with an If criteria

Found the answer to my question on another thread from Domenic:

To count the number of cells that contain a specific text string:

SUMPRODUCT(SUBTOTAL(9,OFFSET(B2:B6,ROW(B2:B6)-MIN(ROW(B2:B6)),0,1)),(C2:C6="Y")+0)

This seems to do the trick.

"Kathy L." wrote:

Thank you, however this won't subtotal only the filtered data, filtered in
Column A.
I'd like the sum to total based on the Filtered Column A, and only the Y's,
however I don't want the user to have to filter on Column C to select the Y's.

"Per Jessen" wrote:

Hi

Use the sumif function:

=SUMIF(C2:C6,"Y",B2:B6)

Regards,
Per

"Kathy L." skrev i meddelelsen
...
Hello,
If the following is example data:
A B C
1 Person $ Selected
2 Tom 10000 Y
3 Jack 15000 Y
4 Tom 20000 N
5 Tom 1000 Y
6 Jack 5000 N
7
8 51000

And cell B8 has the Subtotal(9,b2:b6) function, so I can sum based on a
filter on column A, is there a way to include a criteria in this subtotal
where Column C (selected) is Y?



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
subtotal function using criteria dbroc Excel Worksheet Functions 5 January 10th 10 01:46 AM
Subtotal with additional criteria Danni2004 Excel Worksheet Functions 1 April 23rd 08 08:45 PM
subtotal - multiple criteria mdma Excel Worksheet Functions 7 August 18th 05 05:19 PM
How do I nesting subtotal function within average function in Exc Amy Yeh Excel Worksheet Functions 4 January 19th 05 06:23 PM
SUBTOTAL and then count with criteria Jane Excel Worksheet Functions 3 January 13th 05 07:04 AM


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