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
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

circledchicken

Well-known Member
Joined
Aug 13, 2011
Messages
2,932
Hi,

Maybe try:

=SUMPRODUCT((LEFT(F6:F1000,2)={"CN","KR","MY","NZ","SG","AU","HK","TW"})*(G6:G1000))
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201
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))
 

almagg

Well-known Member
Joined
Aug 21, 2002
Messages
705
thanks
they both worked.

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

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201

ADVERTISEMENT

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))
 

Watch MrExcel Video

Forum statistics

Threads
1,122,554
Messages
5,596,811
Members
414,104
Latest member
imamalidadashzada

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
Top