# Formula within a flow - loads of 2 part IF statements - must be a better way of doing this

I'm new here but the questions and answers here have helped me before so thought I'd try posting.

I'm trying to use a boolean formula that will be referenced in a flow. The idea is to update a checkbox on a contract if any one of these if statements evaluates to true:

IF (ContractTerm = 1 && DATEVALUE(ActivatedDate) = TODAY() + 7, TRUE, FALSE)

IF (ContractTerm = 2 && DATEVALUE(ActivatedDate) = TODAY() + 10, TRUE, FALSE)

IF (ContractTerm = 3 && DATEVALUE(ActivatedDate) = TODAY() + 10, TRUE, FALSE)

IF (ContractTerm = 3 && DATEVALUE(ActivatedDate) = TODAY() + 45, TRUE, FALSE)

IF (ContractTerm = 4 && DATEVALUE(ActivatedDate) = TODAY() + 10, TRUE, FALSE)

IF (ContractTerm = 4 && DATEVALUE(ActivatedDate) = TODAY() + 60, TRUE, FALSE)

IF (ContractTerm = 5 && DATEVALUE(ActivatedDate) = TODAY() + 10, TRUE, FALSE)

IF (ContractTerm = 5 && DATEVALUE(ActivatedDate) = TODAY() + 60, TRUE, FALSE)

IF (ContractTerm = 6 && DATEVALUE(ActivatedDate) = TODAY() + 14, TRUE, FALSE)

IF (ContractTerm = 6 && DATEVALUE(ActivatedDate) = TODAY() + 60, TRUE, FALSE)

IF (ContractTerm = 6 && DATEVALUE(ActivatedDate) = TODAY() + 105, TRUE, FALSE)

IF (ContractTerm = 7 && DATEVALUE(ActivatedDate) = TODAY() + 14, TRUE, FALSE)

IF (ContractTerm = 7 && DATEVALUE(ActivatedDate) = TODAY() + 60, TRUE, FALSE)

IF (ContractTerm = 7 && DATEVALUE(ActivatedDate) = TODAY() + 105, TRUE, FALSE)

IF (ContractTerm = 8 && DATEVALUE(ActivatedDate) = TODAY() + 14, TRUE, FALSE)

IF (ContractTerm = 8 && DATEVALUE(ActivatedDate) = TODAY() + 75, TRUE, FALSE)

IF (ContractTerm = 8 && DATEVALUE(ActivatedDate) = TODAY() + 150, TRUE, FALSE)

IF (ContractTerm = 9 && DATEVALUE(ActivatedDate) = TODAY() + 14, TRUE, FALSE)

IF (ContractTerm = 9 && DATEVALUE(ActivatedDate) = TODAY() + 75, TRUE, FALSE)

IF (ContractTerm = 9 && DATEVALUE(ActivatedDate) = TODAY() + 150, TRUE, FALSE)

IF (ContractTerm = 10 && DATEVALUE(ActivatedDate) = TODAY() + 14, TRUE, FALSE)

IF (ContractTerm = 10 && DATEVALUE(ActivatedDate) = TODAY() + 90, TRUE, FALSE)

IF (ContractTerm = 10 && DATEVALUE(ActivatedDate) = TODAY() + 150, TRUE, FALSE)

IF (ContractTerm = 10 && DATEVALUE(ActivatedDate) = TODAY() + 225, TRUE, FALSE)

IF (ContractTerm = 11 && DATEVALUE(ActivatedDate) = TODAY() + 14, TRUE, FALSE)

IF (ContractTerm = 11 && DATEVALUE(ActivatedDate) = TODAY() + 90, TRUE, FALSE)

IF (ContractTerm = 11 && DATEVALUE(ActivatedDate) = TODAY() + 150, TRUE, FALSE)

IF (ContractTerm = 11 && DATEVALUE(ActivatedDate) = TODAY() + 225, TRUE, FALSE)

IF (ContractTerm = 12 && DATEVALUE(ActivatedDate) = TODAY() + 14, TRUE, FALSE)

IF (ContractTerm = 12 && DATEVALUE(ActivatedDate) = TODAY() + 90, TRUE, FALSE)

IF (ContractTerm = 12 && DATEVALUE(ActivatedDate) = TODAY() + 170, TRUE, FALSE)

IF (ContractTerm = 11 && DATEVALUE(ActivatedDate) = TODAY() + 250, TRUE, FALSE)

I'm currently getting an error when I save the flow telling me I have an extra IF. I definitely have a lot of IFs here.

As this is really long, I'm wondering if it would be better to use CASE() here but I know you can't use true and false with CASE().

This will be referenced in the Decision element of the flow and the idea is that if any one of these 2 part statements is true, a record should move to the Update Records element.

I'm so bad at formulas lol.

Any help would be really appreciated. Thanks in advance :)

Matt

You don't need the IF/TRUE/FALSE for returning a boolean formula result, simply put the logic that you want, combined with ORs...

``````( ContractTerm =  1 && DATEVALUE(ActivatedDate) = TODAY() + 7   ) ||
( ContractTerm =  2 && DATEVALUE(ActivatedDate) = TODAY() + 10  ) ||
( ContractTerm =  3 && DATEVALUE(ActivatedDate) = TODAY() + 10  ) ||
( ContractTerm =  3 && DATEVALUE(ActivatedDate) = TODAY() + 45  ) ||
( ContractTerm =  4 && DATEVALUE(ActivatedDate) = TODAY() + 10  ) ||
( ContractTerm =  4 && DATEVALUE(ActivatedDate) = TODAY() + 60  ) ||
( ContractTerm =  5 && DATEVALUE(ActivatedDate) = TODAY() + 10  ) ||
( ContractTerm =  5 && DATEVALUE(ActivatedDate) = TODAY() + 60  ) ||
( ContractTerm =  6 && DATEVALUE(ActivatedDate) = TODAY() + 14  ) ||
( ContractTerm =  6 && DATEVALUE(ActivatedDate) = TODAY() + 60  ) ||
( ContractTerm =  6 && DATEVALUE(ActivatedDate) = TODAY() + 105 ) ||
( ContractTerm =  7 && DATEVALUE(ActivatedDate) = TODAY() + 14  ) ||
( ContractTerm =  7 && DATEVALUE(ActivatedDate) = TODAY() + 60  ) ||
( ContractTerm =  7 && DATEVALUE(ActivatedDate) = TODAY() + 105 ) ||
( ContractTerm =  8 && DATEVALUE(ActivatedDate) = TODAY() + 14  ) ||
( ContractTerm =  8 && DATEVALUE(ActivatedDate) = TODAY() + 75  ) ||
( ContractTerm =  8 && DATEVALUE(ActivatedDate) = TODAY() + 150 ) ||
( ContractTerm =  9 && DATEVALUE(ActivatedDate) = TODAY() + 14  ) ||
( ContractTerm =  9 && DATEVALUE(ActivatedDate) = TODAY() + 75  ) ||
( ContractTerm =  9 && DATEVALUE(ActivatedDate) = TODAY() + 150 ) ||
( ContractTerm = 10 && DATEVALUE(ActivatedDate) = TODAY() + 14  ) ||
( ContractTerm = 10 && DATEVALUE(ActivatedDate) = TODAY() + 90  ) ||
( ContractTerm = 10 && DATEVALUE(ActivatedDate) = TODAY() + 150 ) ||
( ContractTerm = 10 && DATEVALUE(ActivatedDate) = TODAY() + 225 ) ||
( ContractTerm = 11 && DATEVALUE(ActivatedDate) = TODAY() + 14  ) ||
( ContractTerm = 11 && DATEVALUE(ActivatedDate) = TODAY() + 90  ) ||
( ContractTerm = 11 && DATEVALUE(ActivatedDate) = TODAY() + 150 ) ||
( ContractTerm = 11 && DATEVALUE(ActivatedDate) = TODAY() + 225 ) ||
( ContractTerm = 11 && DATEVALUE(ActivatedDate) = TODAY() + 250 ) ||
( ContractTerm = 12 && DATEVALUE(ActivatedDate) = TODAY() + 14  ) ||
( ContractTerm = 12 && DATEVALUE(ActivatedDate) = TODAY() + 90  ) ||
( ContractTerm = 12 && DATEVALUE(ActivatedDate) = TODAY() + 170 )
``````
• Note: You had CT=11 on the last line - I moved it up to the other 11's - not sure if that was meant that way or supposed to be 12. :) Jun 14, 2022 at 12:05