Forum Discussion
SGeorgie
Nov 13, 2023Brass Contributor
IF FORMULA - Help Needed please
Hi Im trying to write an IF formula and its erroring Basically I this formula worked but i needed the 'not completed' part added! =IF(L4>TODAY(),"Compliant", IF(P4>TODAY(),"Pending",...
djclements
Bronze Contributor
SGeorgie While reading through this thread, I noticed some conflicting statements made about the logic. However, looking at your original question with the first formula your tried, then comparing that to the last formula you tried, I think this might be what you want:
=IFS(AND(ISBLANK(K4),ISBLANK(O4),ISBLANK(U4)), "Not Completed", K4>=TODAY(), "Compliant", OR(O4>=TODAY(), U4>=TODAY()), "Pending", TRUE, "Expired")
The IFS function evaluates each logical test in order and returns the corresponding value for the first TRUE result found. When a logical test returns TRUE, none of the subsequent tests will even be evaluated, so it's important to get the order correct. The above formula is evaluated as follows:
- The first logical test checks if ALL date cells are blank. If TRUE, it returns "Not Completed" and does not evaluate any further.
- The second logical test checks if K4 is greater than or equal to TODAY(). If TRUE, it returns "Compliant", regardless of the other dates.
- For the third logical test, there is no need to check if K4 is less than TODAY(), because that's already a given, since the second logical test returned FALSE. At this point it's only necessary to check if either O4 or U4 is greater than or equal to TODAY(). If TRUE, it returns "Pending".
- Finally, if all three logical tests return FALSE, that means one or more dates are already entered, and they are all in the past, so there is no reason to conduct any further logical tests. Simply use TRUE for the expression to return "Expired".
I hope this works as expected, or at least serves as a guide for how to use the IFS function correctly to figure out the logic you need.
SGeorgie
Nov 14, 2023Brass Contributor
it is still not bringing back any Expired
I have 03/06/2021 in the completed column only and its bringing back Complaint
I have 03/06/2021 in the completed column only and its bringing back Complaint