SUBTOTAL(9,RANGE) Function with SUMIF statements

janema

Board Regular
Joined
Nov 28, 2022
Messages
152
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2011
  5. 2010
Platform
  1. Windows
  2. Mobile
Is there a way to use the Subtotal function with SUMIF statements? I want the file to show the total of data when it is filtered, but cannot seem to add in the Subtotal function into the current formula. Perhaps it's not possible. :(

The current formula is: =(SUMIFS(O:O,T:T,"Yes")*0.035)-SUMIFS(X:X,T:T,"Yes")

So, when the file is filtered, I want it to show the sum of column O if column T equals "Yes" and then subtract the sum of column X if column T equals "Yes"
Right now this pulls the SUM of the column, however, I want them to show as a SUBTOTAL so when I filter it by a leader, it shows the total for what is showing rather than the sum total of the entire file.

I hope that makes sense. Here is what the file looks like:

1737596871960.png


Thank you soooo much in advance for any guidance and help you can give me to figure this out. I've been trying out formulas for the past hour. 😭😭😭
 
I updated and marked the original as the solution.
Thanks for that. (y)


His original solution worked, I just had to fix a part of the formula and his response contained that solution.
Cheers, I understand that - though if you don't try things that have been suggested, it doesn't encourage those people to spend time to help you next time. ;)
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Thanks for that. (y)



Cheers, I understand that - though if you don't try things that have been suggested, it doesn't encourage those people to spend time to help you next time. ;)

Thank you. Very true. I did try every suggestion but seemed to have to go back to the original. I'm sorry, I am not as savvy and amazing at excel as all of you. I appreciate you guys so incredibly much! I have goals to be as good in excel as you guys are! :)
 
Upvote 0
I did try every suggestion but seemed to have to go back to the original.
Does that mean the SUM formula I suggested did not work for you?
The adjustment for your latest ranges would be

Excel Formula:
=SUM((O2:O600*0.035-X2:X600)*(T2:T600="Yes")*SUBTOTAL(103,OFFSET(A1,SEQUENCE(599),0,1,1)))
 
Upvote 0
Does that mean the SUM formula I suggested did not work foe you?
The adjustment for your latest ranges would be

Excel Formula:
=SUM((O2:O600*0.035-X2:X600)*(T2:T600="Yes")*SUBTOTAL(103,OFFSET(A1,SEQUENCE(599),0,1,1)))

For some reason, it gave me a value error. It could very likely be that I missed something with the numbers because I highly doubt your formula was incorrect. I just don't think I understood how to properly write it for my range of data. :(
 
Upvote 0
I just don't think I understood how to properly write it for my range of data.
So, are you changing the formula from post 13 in some way?

To satisfy my curiosity could you try this for me?
  1. Start a blank worksheet

  2. Click this icon
    1737702497271.png
    at the top left of my first mini sheet in post 3

  3. Select A1 in your blank worksheet

  4. Paste
Does it produce -100110 in cell AB2?
If not, what does appear in AB2?

If you filter column A on Amy, does it return -42600 in AB2?
If not, what does it return?
 
Upvote 0
Could you also please try this formula with your data?
Excel Formula:
=SUM(IFERROR((O2:O600*0.035-X2:X600)*(T2:T600="Yes"),0)*SUBTOTAL(103,OFFSET(A1,SEQUENCE(599),0,1,1)))
 
Upvote 0
almost the same with Eric's solution, for your reference:
工作簿1.xlsx
AOTXYZAAAB
1LeaderSalaryMerit EligibilityNew SalaryCurrentFilter
2Amy1000Yes1100-100110-100110
3Bob2000Yes2200
4Amy3000Yes3300
5Bob4000Yes4400
6Cal5000No5500
7Diane6000Yes6600
8Amy7000No7700
9Amy8000Yes8800
10Bob9000Yes9900
11Bob10000Yes11000
12Cal11000Yes12100
13Diane12000Yes13200
14Amy13000Yes14300
15Bob14000No15400
16Amy15000Yes16500
17
Sheet1
Cell Formulas
RangeFormula
Z2Z2=(SUMIFS(O:O,T:T,"Yes")*0.035)-SUMIFS(X:X,T:T,"Yes")
AA2AA2=SUM((O2:O301*0.035-X2:X301)*(T2:T301="Yes")*SUBTOTAL(103,OFFSET(O1,SEQUENCE(300),)))
 
Upvote 0
Not sure what you are saying/suggesting. Is that really any different to post 3?
Oh, sorry. i didn't view all posts in this thread and didn't see post 3. when i opened this thread, i just saw the answer marked as solution which is on the top of page. then copied the minisheet to my own workbook and write formula by myself. This question is not a complicate one, so it is very probably different people get the same answer.
1737712916945.png
 
Upvote 0
Could you also please try this formula with your data?
Excel Formula:
=SUM(IFERROR((O2:O600*0.035-X2:X600)*(T2:T600="Yes"),0)*SUBTOTAL(103,OFFSET(A1,SEQUENCE(599),0,1,1)))

Sure, I will try the ones you asked me to when I'm back at my computer later today. Sorry, I feel asleep last night. Lol
 
Upvote 0

Forum statistics

Threads
1,225,968
Messages
6,188,103
Members
453,460
Latest member
Cjohnson3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top