# IF Functions and Dates

✭✭✭✭

Hi All,

I am trying to use an IF function with dates. For example, IF a date is less than 15 days, return green, less than 30 days, return yellow and more than 30 days return red. When I tried typing this function in using the correct symbols and true/false values, I get an error message. I am creating a log of requests, but there is not a due date associated with the request, only the date the request was initiated. I'm trying to flag requests as green, yellow or red, if they are 15 days or newer (green), 16 - 30 days old (yellow) and more than 30 days old (red).

Is there a way to do this?

Thank you!

Tags:

• ✭✭✭✭✭✭

Hi Chelsea,

Excellent!

One tip. I’d recommend using @row so you don’t need to think about row numbers.

=IF(Done@row = 1, "Gray", IF([Date Logged]@row <= TODAY(-30), "Red", IF([Date Logged]@row <= TODAY(-15), "Yellow", "Green")))

I hope that helps!

Be safe and have a fantastic week!

Best,

Andrée Starå

Workflow Consultant / CEO @ WORK BOLD

SMARTSHEET EXPERT CONSULTANT & PARTNER

Andrée Starå | Workflow Consultant / CEO @ WORK BOLD

W: www.workbold.com | E:[email protected] | P: +46 (0) - 72 - 510 99 35

Feel free to contact me for help with Smartsheet, integrations, general workflow advice, or anything else.

• ✭✭✭✭

I got ahead of myself, but was able to get it figured out. I also added a column to indicate if something is marked as Done to turn it gray. Hope this can help someone.

=IF(Done2 = 1, "Gray", IF([Date Logged]2 <= TODAY(-30), "Red", IF([Date Logged]2 <= TODAY(-15), "Yellow", "Green")))

• ✭✭✭✭✭✭

Hi Chelsea,

Excellent!

One tip. I’d recommend using @row so you don’t need to think about row numbers.

=IF(Done@row = 1, "Gray", IF([Date Logged]@row <= TODAY(-30), "Red", IF([Date Logged]@row <= TODAY(-15), "Yellow", "Green")))

I hope that helps!

Be safe and have a fantastic week!

Best,

Andrée Starå

Workflow Consultant / CEO @ WORK BOLD

SMARTSHEET EXPERT CONSULTANT & PARTNER

Andrée Starå | Workflow Consultant / CEO @ WORK BOLD

W: www.workbold.com | E:[email protected] | P: +46 (0) - 72 - 510 99 35

Feel free to contact me for help with Smartsheet, integrations, general workflow advice, or anything else.

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!