Littlemalky
Board Regular
- Joined
- Jan 14, 2011
- Messages
- 223
I have this really long formula, but just realized that I need to set negative values to zero. If I put an "IIF Statement" around it, Access tells me there are too many characters. Does anybody have any suggestions?
IIf((IIf(([PAYOUT_DATE]>=[GUARANTEE_START_DATE] And [PAYOUT_DATE]<=[GUARANTEE_END_DATE]),[GUARANTEE_AMOUNT],0))*(IIf(IIf(Day([PAYOUT_DATE])>=Day([GUARANTEE_START_DATE]),0,-1)+(Year([PAYOUT_DATE])-Year([GUARANTEE_START_DATE]))*12+(Month([PAYOUT_DATE])-Month([GUARANTEE_START_DATE]))<4,1,0))=0,[PAYOUT_AMT],(IIf(([PAYOUT_DATE]>=[GUARANTEE_START_DATE] And [PAYOUT_DATE]<=[GUARANTEE_END_DATE]),[GUARANTEE_AMOUNT],0))*(IIf(IIf(Day([PAYOUT_DATE])>=Day([GUARANTEE_START_DATE]),0,-1)+(Year([PAYOUT_DATE])-Year([GUARANTEE_START_DATE]))*12+Month([PAYOUT_DATE])-Month([GUARANTEE_START_DATE])<4,1,0)))
IIf((IIf(([PAYOUT_DATE]>=[GUARANTEE_START_DATE] And [PAYOUT_DATE]<=[GUARANTEE_END_DATE]),[GUARANTEE_AMOUNT],0))*(IIf(IIf(Day([PAYOUT_DATE])>=Day([GUARANTEE_START_DATE]),0,-1)+(Year([PAYOUT_DATE])-Year([GUARANTEE_START_DATE]))*12+(Month([PAYOUT_DATE])-Month([GUARANTEE_START_DATE]))<4,1,0))=0,[PAYOUT_AMT],(IIf(([PAYOUT_DATE]>=[GUARANTEE_START_DATE] And [PAYOUT_DATE]<=[GUARANTEE_END_DATE]),[GUARANTEE_AMOUNT],0))*(IIf(IIf(Day([PAYOUT_DATE])>=Day([GUARANTEE_START_DATE]),0,-1)+(Year([PAYOUT_DATE])-Year([GUARANTEE_START_DATE]))*12+Month([PAYOUT_DATE])-Month([GUARANTEE_START_DATE])<4,1,0)))