Forum Discussion
IF FORMULA - Help Needed please
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.
- SGeorgieNov 14, 2023Brass Contributorit is still not bringing back any Expired
I have 03/06/2021 in the completed column only and its bringing back Complaint - SGeorgieNov 14, 2023Brass ContributorAlso one row has completed date (K4) 12/08/2021 but also U4 as 10/10/2024 so should say 'Pending' not 'Compliant'
- djclementsNov 14, 2023Bronze Contributor
SGeorgie I just input those dates into my spreadsheet and it returned "Pending" correctly. My only guess would be that your date cells are formatted as Text. Please make sure they are formatted as Dates and try again.
- djclementsNov 14, 2023Bronze Contributor
SGeorgie Also, verify that your current systems settings accurately reflect today's date. Other than that, I'm out of ideas. Even the last really long IFS formula you posted works correctly in my spreadsheet, so there must be something going on with either the way your data is formatted, or with your current system date settings.
- djclementsNov 14, 2023Bronze Contributor
SGeorgie One last suggestion... make sure your Calculation Options are set to Automatic, or press F9 on your keyboard to recalculate the entire workbook. The most likely reason you're getting incorrect results is that your Calculation Options are set to Manual.
- SGeorgieNov 15, 2023Brass ContributorI cannot get it to work - no expired shows
ive tried F9
I have made sure all date columns ae Date and correct format - K/O/U is 2019-06-01
Column L, P and V though have =K+1-1 so they display as 01/06/2019
Does that make a difference? Any way I can send you my dummy file?