Sum with conditionals

mickeystanford_alumni

Board Regular
Joined
May 11, 2022
Messages
129
Office Version
  1. 2021
Platform
  1. Windows
  2. MacOS
Hi all, hope good yourside.
I wanted to make a sumifs for this simple table with 3 columns, where Sales is the sum range, and year and country are the criteria range.
Though, I would like to have 3 possibilities where I'm struggling with:
- To sum all sales values for a certain year for 2 countries (China and the US).
- To sum all sales values for a certain year for all countries except Japan and Germany.

Any chance you could give me a hand there?

Cheers


YearCountrySales
2015​
US
113281.1​
2015​
Germany
86074.67​
2015​
China
75170.13​
2015​
Japan
58491.69​
2015​
UK
49316.31​
2015​
Brazil
48853.49​
2015​
India
48580.47​
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
have you tried the sumifs() function?
 
Upvote 0
like this?

Book1
ABCDEFGHI
1YearCountrySalesYearCountrySalesxCountrySales
22015US1132812015US188451Japan507348
32015Germany86074ChinaGermany
42015China75170
52015Japan58491
62015UK49316
72015Brazil48853
82015India48580
92016US11328.1
102016Germany8607.4
112016China7517
122016Japan5849.1
132016UK4931.6
142016Brazil4885.3
152016India4858
Sheet1
Cell Formulas
RangeFormula
G2G2=SUMIFS(C2:C15,A2:A15,E2,B2:B15,F2)+SUMIFS(C2:C15,A2:A15,E2,B2:B15,F3)
I2I2=SUMIF(A2:A15,E2,C2:C15)-SUMIFS(C2:C15,A2:A15,E2,B2:B15,H2)+SUMIFS(C2:C15,A2:A15,E2,B2:B15,H3)
Cells with Data Validation
CellAllowCriteria
E2List=$A$8:$A$9
 
Upvote 0
Hi AlanY, is there any way to make it <>"Japan"&"Germany"
Something like that inside the sumifs function?
 
Upvote 0
How about
Fluff.xlsm
ABCDEFGHI
1YearCountrySalesYearCountrySalesxCountrySales
22015US1132812015US188451Japan335200
32015Germany86074ChinaGermany
42015China75170
52015Japan58491
62015UK49316
72015Brazil48853
82015India48580
92016US11328.1
102016Germany8607.4
112016China7517
122016Japan5849.1
132016UK4931.6
142016Brazil4885.3
152016India4858
View
Cell Formulas
RangeFormula
G2G2=SUM(SUMIFS(C:C,A:A,E2,B:B,F2:F3))
I2I2=SUMIFS(C:C,A:A,E2)-SUM(SUMIFS(C:C,A:A,E2,B:B,H2:H3))
 
Upvote 0
Solution
How about
Fluff.xlsm
ABCDEFGHI
1YearCountrySalesYearCountrySalesxCountrySales
22015US1132812015US188451Japan335200
32015Germany86074ChinaGermany
42015China75170
52015Japan58491
62015UK49316
72015Brazil48853
82015India48580
92016US11328.1
102016Germany8607.4
112016China7517
122016Japan5849.1
132016UK4931.6
142016Brazil4885.3
152016India4858
View
Cell Formulas
RangeFormula
G2G2=SUM(SUMIFS(C:C,A:A,E2,B:B,F2:F3))
I2I2=SUMIFS(C:C,A:A,E2)-SUM(SUMIFS(C:C,A:A,E2,B:B,H2:H3))
Hi Fluff, txs a lot. Tx also to AlanY.

I was wondering if for the formula I2 you put, I could also include 2015 and 2016 in the same way you did with H2:H3. I am trying but not working.

Txx again
 
Upvote 0
That'd mean,
=SUMIFS(C:C,A:A,E2)-SUM(SUMIFS(C:C,A:A,H5:H6,B:B,H2:H3)

where H5:H6 is 2015, 2016

however just giving me the number of 2015 for the final result
 
Upvote 0
How about
Excel Formula:
=SUM(SUMIFS(C:C,A:A,E2:E3))-SUM(SUMIFS(C:C,A:A,TRANSPOSE(E2:E3),B:B,H2:H3))
 
Upvote 0

Forum statistics

Threads
1,215,103
Messages
6,123,107
Members
449,096
Latest member
provoking

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