sum on multiple criteria

almagg

Well-known Member
Joined
Aug 21, 2002
Messages
705
i want to go thru a list and sum on the criteria that matches the first two letters.
in this particular case, sum if the first two letters are any of:
CN, KR, MY, NZ, SG, AU, HK, TW

ColG.............................................ColH
.
.
CN080: Marine-NSW........................1611
DE066: FPS Mobile Offenburg............1211
KR007: TSP Dongbang Plant..............17120
NZ032: Auckland-Wormald-Service.....8843
UK033: Frome, JW singer, UK.............2011
.
.

i tried this but then realized ALL of the criteria must be met.

=SUMIFS(G6:G1000,$F$6:$F$1000,"CN"&"*",$F$6:$F$1000,"KR"&"*",$F$6:$F$1000,"MY"&"*",$F$6:$F$1000,"NZ"&"*",$F$6:$F$1000,"SG"&"*",$F$6:$F$1000,"AU"&"*",$F$6:$F$1000,"HK"&"*",$F$6:$F$1000,"TW"&"*")

also tried a regular sumif suing OR

sumif(F6:F1000, OR("CN"&"*", "KR"&"*", "NZ"&"*"),G6:G1000)

any ideas?
thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
i want to go thru a list and sum on the criteria that matches the first two letters.
in this particular case, sum if the first two letters are any of:
CN, KR, MY, NZ, SG, AU, HK, TW

ColG.............................................ColH
.
.
CN080: Marine-NSW........................1611
DE066: FPS Mobile Offenburg............1211
KR007: TSP Dongbang Plant..............17120
NZ032: Auckland-Wormald-Service.....8843
UK033: Frome, JW singer, UK.............2011
.
.

i tried this but then realized ALL of the criteria must be met.

=SUMIFS(G6:G1000,$F$6:$F$1000,"CN"&"*",$F$6:$F$1000,"KR"&"*",
$F$6:$F$1000,"MY"&"*",$F$6:$F$1000,"NZ"&"*",$F$6:$F$1000,"SG"&"*",
$F$6:$F$1000,"AU"&"*",$F$6:$F$1000,"HK"&"*",$F$6:$F$1000,"TW"&"*")

also tried a regular sumif suing OR

sumif(F6:F1000, OR("CN"&"*", "KR"&"*", "NZ"&"*"),G6:G1000)

any ideas?
thanks

Try...

=SUM(SUMIF(F6:F1000, {"CN","KR","NZ"}&"*",G6:G1000))
 
Upvote 0
thanks
they both worked.

the brackets i guess indicate an array?
just wondering how to know to use them in other cases.
 
Upvote 0
thanks
they both worked.

the brackets i guess indicate an array?
just wondering how to know to use them in other cases.

{"CN","KR","NZ"} is called an array constant. If you would put the items in a 3-cell range and name List that range, you had to invoke:

=SUMPRODUCT(SUMIF(F6:F1000,List&"*",G6:G1000))
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,269
Members
449,075
Latest member
staticfluids

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