SUMIF simplification - multiple criteria

gaj104

Well-known Member
Joined
Nov 9, 2002
Messages
864
Hi,

I'm using a cumbersome SUMIF formula

=-SUMIF(PL2006!AO:AO,"ECH",PL2006!AN:AN)-SUMIF(PL2006!AO:AO,"XCH",PL2006!AN:AN)

I tried to change it to the following but it did not work

=-SUMIF(PL2006!AO:AO,OR("ECH","XCH"),PL2006!AN:AN)

Is there a formula to simplfy the first one, mainly as I will need to add futher 3 letter criteria.

Many thanks
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Try...

=-SUM(SUMIF(PL2006!AO:AO,{"ECH","XCH"},PL2006!AN:AN))

Hope this helps!
 
Upvote 0
that looks really useful.. but I cant get that to work, any ideas what Im doing wrong...
my formula to test was..
=SUMIF(H:H,{"s","sd"},G:G)
it only counts those that equal "s" though..
 
Upvote 0
I added the Sum around the formula and it works. Can someone explain why it needs to be wrapped in a sum () please ?
 
Upvote 0
I added the Sum around the formula and it works. Can someone explain why it needs to be wrapped in a sum () please ?

In this case, SUMIF has two values as its criteria, as specified by the array constant...

{"s","sd"}

Since the criteria is an array, SUMIF returns an array made up of two values. The first value with "s" as its criteria, and the second with "sd". These values are then passed to SUM which it sums.

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,217,481
Messages
6,136,903
Members
450,029
Latest member
MissQuotation

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