combining 2 formulas for sub ifs

munozc

New Member
Joined
Nov 20, 2020
Messages
3
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?!
 

Some videos you may like

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,653
Office Version
  1. 365
Platform
  1. Windows
Hi & welcome to MrExcel.
Do you want to ignore hidden rows in your sum?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,653
Office Version
  1. 365
Platform
  1. Windows
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))
 
Solution

munozc

New Member
Joined
Nov 20, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
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!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,653
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,808
Messages
5,627,010
Members
416,214
Latest member
boston814

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
Top