superfly5203
Registered User.
- Local time
- Today, 02:49
- Joined
- Apr 5, 2016
- Messages
- 43
I have the following statement in a calculated field which calculates the number of days late a proposal is:
This code works fine, if one of the 4 change types are dected, it uses the "CCO Date" instead of the "CDapprovaldate" field to calculate the days for proposal delivery. The -90 at the end of the true/ false statements is how long the contractor has to deliver the proposal, so if they took 100 days this calculated field would return a value of 10, as in 10 days late. My problem is, I have three contracts A, B, and C and they all have different proposal delivery dates 90, 60, and 30.
I tried to put another IIf statement at the end of this one, and it said I had incorrect syntax somewhere. I have seen a lot of nested IIf statements and switch statements while researching this problem, but I haven't seen one evaluate two different criteria (maybe I didn't look long enough ).
So how can I combine these three IIf statements into one working statement in one calculated field?
Code:
IIf([Contract]="A" And [Change Type]=2 Or [Change Type]=4 Or [Change Type]=9 Or [Change Type]=11,([actualproposal]-[CCO Date])-90,([actualproposal]-[CDapprovaldate])-90)
This code works fine, if one of the 4 change types are dected, it uses the "CCO Date" instead of the "CDapprovaldate" field to calculate the days for proposal delivery. The -90 at the end of the true/ false statements is how long the contractor has to deliver the proposal, so if they took 100 days this calculated field would return a value of 10, as in 10 days late. My problem is, I have three contracts A, B, and C and they all have different proposal delivery dates 90, 60, and 30.
I tried to put another IIf statement at the end of this one, and it said I had incorrect syntax somewhere. I have seen a lot of nested IIf statements and switch statements while researching this problem, but I haven't seen one evaluate two different criteria (maybe I didn't look long enough ).
So how can I combine these three IIf statements into one working statement in one calculated field?
Code:
IIf([Contract]="A" And [Change Type]=2 Or [Change Type]=4 Or [Change Type]=9 Or [Change Type]=11,([actualproposal]-[CCO Date])-90,([actualproposal]-[CDapprovaldate])-90)
IIf([Contract]="B" And [Change Type]=2 Or [Change Type]=4 Or [Change Type]=9 Or [Change Type]=11,([actualproposal]-[CCO Date])-30,([actualproposal]-[CDapprovaldate])-30)
IIf([Contract]="C" And [Change Type]=2 Or [Change Type]=4 Or [Change Type]=9 Or [Change Type]=11,([actualproposal]-[CCO Date])-60,([actualproposal]-[CDapprovaldate])-60)