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