SumIF with range across columns and rows

unirSEO

New Member
Joined
Apr 11, 2017
Messages
3
Hello everyone.

I am trying to do a SUMIF where the range consists of multiple columns and rows rather than just a single column.

for example:

ABCD
1Store 1Store 2Store 3Store 4
2LondonChicagoParis5
3ParisNYOttawa18
4EdinburghOttawaParis21
5EdinburghOttawaParis9
6ChicaoLondonParis46
7NYBerlinLA0
8WellingtonMontrealParis44
9BerlinBerlinParis18
10OttawaParisOttawa7
11LondonParisLondon12
12MadridLondonLondon6

<tbody>
</tbody>


I want to add together all the Stock for my London stores. Note that the last two rows has London twice.
The sum of that stock is 87 (5+46+12+12+6+6)

I have been messing around with index/match, with CONCATENATE on the stores and using a FIND with a SUMIF, but so far I can't figure out a way of doing it.

But in the end I want a nice table like this-

FG
1CitySum of Stock
2Berlin36
3Chicago51
4Edinburgh30
5London87
6LA0
7Madrid6
8Montreal44
9NY18
10Ottawa62
11Paris162
12Wellington44

<tbody>
</tbody>


Any ideas anyone?

Thanks!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Multiple SUMIF is the most straightforward solution:


Book1
ABCDEFG
1Store 1Store 2Store 3Store 4CitySum of Stock
2LondonChicagoParis5Berlin36
3ParisNYOttawa18Chicago51
4EdinburghOttawaParis21Edinburgh30
5EdinburghOttawaParis9London87
6ChicagoLondonParis46LA0
7NYBerlinLA0Madrid6
8WellingtonMontrealParis44Montreal44
9BerlinBerlinParis18NY18
10OttawaParisOttawa7Ottawa62
11LondonParisLondon12Paris180
12MadridLondonLondon6Wellington44
Sheet1
Cell Formulas
RangeFormula
G2=SUMIF($A$2:$A$12,$F2,$D$2:$D$12)+SUMIF($B$2:$B$12,$F2,$D$2:$D$12)+SUMIF($C$2:$C$12,$F2,$D$2:$D$12)


WBD
 
Upvote 0
Thanks WBD.

I was trying to resolve it with a single expression, but that way (which hadn't ocurred to me) is ace!

thanks very much.
 
Upvote 0
A
B
C
D
E
F
G
1
Store 1Store 2Store 3Store 4CitySum of Stock
2
LondonChicagoParis
5​
Berlin
36​
3
ParisNYOttawa
18​
Chicago
51​
4
EdinburghOttawaParis
21​
Edinburgh
30​
5
EdinburghOttawaParis
9​
London
87​
6
ChicagoLondonParis
46​
LA
0​
7
NYBerlinLA
0​
Madrid
6​
8
WellingtonMontrealParis
44​
Montreal
44​
9
BerlinBerlinParis
18​
NY
18​
10
OttawaParisOttawa
7​
Ottawa
62​
11
LondonParisLondon
12​
Paris
180​
12
MadridLondonLondon
6​
Wellington
44​

<tbody>
</tbody>


g2=
SUMPRODUCT(($A$2:$C$12=$F2)*($D$2:$D$12))

 
Upvote 0

Forum statistics

Threads
1,215,086
Messages
6,123,035
Members
449,092
Latest member
ikke

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