Modifying Sum Range in Sumif Formula

andybason

Board Regular
Joined
Jan 7, 2012
Messages
217
Office Version
  1. 2016
Hello

I have a table (extract below) and I am trying to do a sumif to find in-stock items and then deduct 10% from each price before summing the result.

I can do a sumif for the actual price (=SUMIF(Table1[stock],"in",Table1[price])) but I can't work out how to deduct 10% from each price first.

Can anyone help?

Thank you

| id | stock | price |
| -- | ----- | ----- |
| 1 | in | 6.8 |
| 2 | out | 5.9 |
| 3 | out | 18.5 |
| 4 | in | 6.2 |
| 5 | out | 18 |
| 6 | out | 5 |
| 7 | in | 7.8 |
| 8 | in | 6.6 |
| 9 | in | 9.6 |
| 10 | out | 3.7 |
| 11 | out | 12.5 |
| 12 | in | 4.6 |
| 13 | out | 14 |
| 14 | in | 17.5 |
| 15 | in | 10.5 |
| 16 | out | 13.5 |
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
try:
mr excel questions 24.xlsm
ABCD
1 id stock price
2 -- ----- -----
31in6.862.64
42out5.9
53out18.5
64in6.2
75out18
86out5
97in7.8
108in6.6
119in9.6
1210out3.7
1311out12.5
1412in4.6
1513out14
1614in17.5
1715in10.5
1816out13.5
Sheet9
Cell Formulas
RangeFormula
D3D3=SUMPRODUCT((C3:C18*(1-0.1))*(--(B3:B18="in")))
 
Upvote 0
Would taking 10% away from the sum you have give you the result needed or do you need it row by row?

Something like:
Excel Formula:
=SUMIF(Table1[stock],"in",Table1[price])*0.9
 
Upvote 1
Another option
Excel Formula:
=SUMPRODUCT((Table1[stock]="in")*(Table1[price]*0.9))
 
Upvote 1
Solution

Forum statistics

Threads
1,215,467
Messages
6,124,985
Members
449,201
Latest member
Lunzwe73

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