In this article, you will see how you can change color when a Birthday is coming up without using a macro.
Step 1: Add today's date
First of all, add the current date in a new column using the function TODAY().
Step 2: Months until birthday
In a new column, calculate the number of months remaining until the birthday.
Use the DATEDIF function and the parameter "ym" (number of months in the current year).
Step 3: Days until birthday
In the same way, we calculate the number of days until the birthday.
Use the function DATEDIF again but with the value"md" this time for the third argument.
Step 4: Analyze the result
As you can see on the picture
- If the birthday is soon, the value of the number of days and months is large
- On the other hand, if the birthday is right around now, both value are close to 0
In this situation, it is not easy to generate a warning when a birthday is coming up. Except if you add a visual reminder 😉😋💡
Step 5: Add a reminder
Decide how many days before the birthday you want to set a reminder and enter this into another cell. In the example below I have added 7 days in cell I2. Change the previous formula to include this value as per the example below.
The formula for months becomes
The formula for days becomes
Write the reference of the delay with an absolute reference. In this example that would be $I$2.
Step 6: Test whether or not to display a reminder
The test for the month is really easy because the value must be 0.
The test for the days is not complex but it is clever. We will test if the difference between days until birthday and reminder is lower than or equal to the reminder.
The test is:
Merge these 2 tests into a single one with the logical operator AND.
The test returns TRUE if the number of days until the birthday is less than or equal to the reminder. However, it isn't really easy to identify which cells return TRUE at first glance. This is why we are going to write this test in a conditional formatting rule.
Step 7: Add conditional formatting
- Firstly, copy the formula of the test (with the AND)
- Open the menu Home > Conditional Formatting > New rule
- Select the option Use a formula to determine which cells to format
- Paste the formula
- Customize the format when the rule is TRUE (here font color: white and background: red)
Step 8: Change the data range for conditional formatting
The final step is to apply this conditional formatting to the whole column.
- Open the menu Home > Conditional Formatting > Manage rules
- In the text box Apply to, select the range of cells to apply the conditional formatting to.
The final result is displayed below: