Nested subtraction in SUMIFS

filido

New Member
Joined
Jun 7, 2019
Messages
21
Hi,

I'm trying to populate a formula that sums all the sales of a particular item with few conditions:

=SUMIFS(Table1[Sales New] - Table1[Sales Change]; Table1[Sales New] - Table1[Sales Change];">0";Table1[Sales New];">0";Table1[Item];"Blue shirt")

--> Table1[Sales New]-Table1[Sales Change] = Old Sales of the blue shirt
--> Table1[Sales New] = New Sales of the blue shirt
--> Table1[Item];"Blue shirt" = Find item "Blue shirt" from list of items

So this is what I want: SUM all blue shirts' Old Sales, IF Old Sales AND New Sales are both over 0.

Excel however says that there's an error with this formula. Any thoughts?

I know I could get around this by creating a column for Old Sales but for the sake of the file size, I want to keep the number of columns as minimum as possible.

I also tried this: Table1[Price Old] * Table1[Quantity] to get the old sales but this also caused an error.

=SUMIFS(Table1[Price Old] * Table1[Quantity]; Table1[Price Old] * Table1[Quantity];">0";Table1[Sales New];">0";Table1[Item];"Blue shirt")

Thanks in advance!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Sumifs only accepts ranges for its sum ranges and criteria ranges. You would have to use sumproduct to do subtraction.

=SUMPRODUCT((Table1[Sales New] - Table1[Sales Change]),--((Table1[Sales New] - Table1[Sales Change])>0),--(Table1[Sales New]>0),--(Table1[Item]="Blue shirt"))
 
Upvote 0
Hi,

That formula returns #N/A. Is the formula affected if e.g. some sales of the blue shirt is #N/A? Below is an example data:

DateShirtSales NewSales Change (from last year)
MondayBlue shirt22+2
MondayWhite shirt25-5
TuesdayBlue shirt#N/A#N/A
WednesdayBlue shirt15+5
WednesdayRed shirt200

<tbody>
</tbody>

Because Tuesday's blue shirt data is unavailable, is my SUMPRODUCT formula affected by it and causes the formula to return #N/A?

If #N/A doesn't affect the SUMPRODUCT, what else might be the problem?
 
Upvote 0
Yes you will have to correct the n/a for all entries in the column. Use an iferror formula. You could also do with using the same headers as you suggested in post 1.
 
Upvote 0

Forum statistics

Threads
1,214,792
Messages
6,121,612
Members
449,039
Latest member
Mbone Mathonsi

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