Forum Discussion

Abbie0975's avatar
Abbie0975
Copper Contributor
Aug 15, 2023

Conditional formatting based on dates

If I have a ‘received date’ in column B and a ‘completed date’ in Column D and want column E to turn green if the completed date was within 7 days and red if over 7 days, what formula do I use?  Thank you. 

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor

    Abbie0975 

    1. Select the cells in col E
    2. Choose Conditional format, New Rule
    3. Select "Use formula to determine..."
    4. Enter this formula (assuming your data starts on row 2):
      =D2-C2<=7
    5. Click Format and set a green fill.

    Do these same steps for over 7 days, change the formula to D2-C2>7 and set a red fill

    • Abbie0975's avatar
      Abbie0975
      Copper Contributor

      JKPieterse thank you so much, I will give it a try. 
      I also have a colum calculating the number of days between received and completed, do you know if there’s a formula I can use to calculate the overall percentage that are within the 7 days?  Thank you again. 

      • HansVogelaar's avatar
        HansVogelaar
        MVP

        Abbie0975 

        Let's say the number of days can be found in G2:G50.

        Enter the following formula in a cell  and format it as a percentage:

        =COUNTIF(G2:G50, "<=7")/COUNT(G2:G50)

Resources