combining 2 formulas for sub ifs

munozc

New Member
Joined
Nov 20, 2020
Messages
5
Office Version
  1. 365
Platform
  1. Windows
I found 2 very helpful formulas that work separately but I'm looking to find a way to combine them.

I want to calculate the subtotal of D2:D101 only if the number is greater than 0 (so no negative amounts) and if the transaction type is "SALE" for G2:G101

=SUMPRODUCT(SUBTOTAL(9,OFFSET(D2,ROW(D2:D101)-ROW(D2),0,1)),--(D2:D101>0))

=SUMPRODUCT(SUBTOTAL(3,OFFSET(D2:D101,ROW(D2:D101)-MIN(ROW(D2:D101)),,1)),--(G2:G101="SALE"),D2:D101)

if there is 1 easier way to accomplish this then that would be great too :)
1605898519514.png


Can anyone please help me?!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi & welcome to MrExcel.
Do you want to ignore hidden rows in your sum?
 
Upvote 0
In that case how about
Excel Formula:
=SUMPRODUCT(SUBTOTAL(9,OFFSET(D2:D101,ROW(D2:D101)-MIN(ROW(D2:D101)),,1)),(G2:G101="SALE")*(D2:D101>0))
 
Upvote 0
Solution
In that case how about
Excel Formula:
=SUMPRODUCT(SUBTOTAL(9,OFFSET(D2:D101,ROW(D2:D101)-MIN(ROW(D2:D101)),,1)),(G2:G101="SALE")*(D2:D101>0))
YES!!!! THAT WORKED PERFECTLY!!! THANK YOU!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,840
Messages
6,121,895
Members
449,058
Latest member
Guy Boot

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