Highlight the birthday automatically.
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
Let's convert this test to a custom conditional formatting rule.
- 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:
14/02/2020 @ 00:49
There's an error in the =AND(E2=0,F2<=$I$2) formula , or at least it won't work on my version of excel (2016) it needs to be a ; after E2=0;F2<=$I$2 instead of a regular comma, otherwise excel removes it and you won't get the correct returned value.
It corrects it to =AND(E2=0<=$I$2) which obviously won't work.
Just wanted to let you know that, maybe it is different in a later version of excel?
22/10/2019 @ 12:12
This formula is not working in my excel sheet. why?, I need a solution of regarding this issue.
Frédéric LE GUEN
23/10/2019 @ 17:13
Which formula doesn't work?