# How to calculate days past due based on "text" in another column

✭✭✭✭

I need help creating the formula to calculate the number of days an item is past due based on my Status column. The Status column contains the drop-down selection of “Complete”, “Not Started”, and “In Progress”. I want the calculation to return a number whenever “Complete” is NOT selected. I’ve seen variations on this type of question based on using a Complete column and a check box, but I don’t want to have to update two columns when one will suffice to identify if something is complete or not.

• ✭✭✭✭✭✭

You are actually going to want an AND function. If you use an OR function then you are saying

If it is not "this" or not "that"

Well "this" is definitely not "that", so it will trigger a true. Give this one a whirl...

=IF(AND(Status7 <> "Complete", Status7 <> "Excluded", Status7 <> "Deferred"), IF(TODAY() - [Due Date]7 >= 0, TODAY() - [Due Date]7))

• ✭✭✭✭

Thank you Paul. I made a slight adjustment and ended up with =IF(Status@row <> "Complete", TODAY() - [Due Date]@row), then I put in a Conditional Format so that when the number was <1 the font is made white so that the negative numbers are not visible. I'm not sure what to do in the formula to keep negative numbers from being displayed so that was my work around. If you have a better idea let me know. Thanks again.

• ✭✭✭✭

That worked great! Thanks. Now I can perform a metric to count the number of line items past due based on that column =COUNTIF([Days Past Due]:[Days Past Due], >=1)

Thank you.

• ✭✭✭✭✭✭

Your COUNTIF would also work with your solution of including the negative numbers and "hiding" them since the criteria for your COUNTIF is greater than or equal to zero.

There are a number of variations you can use (as you can see). The best one will depend on your overall goal. Sometimes it is easier to make the source sheet a little more complex so that the metrics formulas can be a little more simple. Other times it won't make a huge difference either way.

• ✭✭✭✭

Hi Paul,

New wrinkle to this same issue. I now need to add more exclusion text to the formula. I want to show days past due if the text in the cell is NOT "Complete", "Excluded", or "Deferred". This is my current formula: =IF(Status7 <> "Complete", IF(TODAY() - [Due Date]7 >= 0, TODAY() - [Due Date]7)). How do I add the terms "Excluded" and "Deferred" after "Completed"? I tried to use the OR syntax but couldn't get it to work correctly.

• ✭✭✭✭✭✭

You are actually going to want an AND function. If you use an OR function then you are saying

If it is not "this" or not "that"

Well "this" is definitely not "that", so it will trigger a true. Give this one a whirl...

=IF(AND(Status7 <> "Complete", Status7 <> "Excluded", Status7 <> "Deferred"), IF(TODAY() - [Due Date]7 >= 0, TODAY() - [Due Date]7))

• ✭✭✭✭

Worked like a charm. Thank you.

• ✭✭✭✭✭✭

Happy to help. 👍️