SumIf Formula with Multiple Criteria

lindz5970

New Member
Joined
Dec 8, 2014
Messages
13
I'm trying to create a Sumif formula that contains multiple 'ifs'. I was able to do this using the formula I pasted below but my "Type" field has grown to be too many different options and now my expression is too long for Access to handle so I need to consolidate this somehow while still maintaining the same result.

Original formula:
Sum(IIf([retro count]<>0 And [contract]="S" And [Type]="ABC",[retro count],0))+Sum(IIf([retro count]<>0 And [contract]="S" And [Type]="DEF",[retro count],0))+Sum(IIf([retro count]<>0 And [contract]="S" And [Type]="GHI",[retro count],0+Sum(IIf([retro count]<>0 And [contract]="S" And [Type]="JKL",[retro count],0))....

The underlined part is essentially the whole expression. I just kept adding them together, copying the expression and just changing the "Type" (I have about 20 "Types" now)

I tried adding an "Or" and listing the multiple types but it only worked when I had one Or. When I added more than 2 Ors it errored out:
Sum(IIf([retro count]<>0 And [contract]="S" And [Type]="ABC" or [Type]="DEF",[retro count],0))

I'm sure there is a simpler way to accomplish what I'm trying to do but can't figure it out. Any help would be greatly appreciated, Thanks!
 
Have experienced that before. Can't recall what they look like but I think they had a weird looking slant and/or odd descenders.
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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