# Using Flow but need Complex equation to set a value

I'm using a flow to do a nightly (1am) job. This job sets a Boolean to false if it is true and to true if the Next Email Date is Today().

I need to use this job to also set the Next email date for all those records where Next Test Date is today.

I did this in a Formula field when testing the logic but now I see that the temporary nature of formula fields is causing an issue.

Is there a way to program a formula into a Flow without breaking it down into separate conditions?

``````IF(ISNULL(Last_Email_Date__c),
IF(ISNULL(Last_Test_Date__c), "A: Double Null",
IF((TODAY()-Last_Test_Date__c)<335, "B: Null Email, Recent Test Date", "C: Null Email, No Recent Test")),
IF(ISNULL(Last_Test_Date__c),
IF((TODAY()-Last_Email_Date__c)<365,"D: Null Test, Email in Last 365 days",
IF(AND(MONTH( Last_Email_Date__c ) = 2,DAY( Last_Email_Date__c ) = 29),"E: Null Test, 29th February","F: Null Email but not 29th Feb")),
IF(Last_Email_Date__c>Last_Test_Date__c, "H: No Nulls, Email more recent than Test" ,
IF(AND(MONTH( Last_Email_Date__c ) = 2,DAY( Last_Email_Date__c ) = 29),"G: but for 2.29",
IF((TODAY()-Last_Test_Date__c)>335, "H: Use Today()","G: No Nulls, Test more recent than Email")
)
)
)
)
``````
• I added my own answer but would love to know if the Flows allows more complex equations. – SeanGorman Apr 19 at 16:43

Yes. You can create a Flow Resource of type Formula. You'll get a place to enter your formula (much like a formula field), but you'll be able to reference other Flow Resources, including sObject variables and the various global value providers like `\$Setup`.