conditional formatting based on number of days between two dates

fingermouse

Board Regular
Joined
Dec 13, 2013
Messages
117
01/08/2018
27/08/2018
If the amount of days between A1 and B1 is less than or equal to 26, make B1 green in colour
01/08/2018
28/08/2018
If the amount of days between A2 and B2 is greater than 26 but less than 31, make B2 amber in colour
01/08/2018
01/09/2018
If the amount of days between A3 and B3 is greater than or equal to 31, make B3 red in colour

<tbody>
</tbody>
Hi,

I need an excel formula which will change the colour of a cell based on the number of days between two dates.

I presume I would have to enter this formula in the 'new formatting rule' dialogue box in the conditional formatting menu.

(sorry,I cant seem to be able to add the table after the text! Also, the date format is DD/MM/YYYY.)

Any help much appreciated!

thanks, Cal.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Steps:

1. Highlight the cells in Column B that you want to format
2. Choose Conditional Formatting -> New Rule from the menu
3. Select the option to "Use a formula to determine which cells to format"
4. In the formula box enter this: =($B1-$A1)<=26
5. Set the format to color the cell green
6. Click OK
7. Choose Conditional Formatting -> Manage Rules from the menu
8. Check the box that says "Stop If True"

Now repeat steps 2 to 6 with these formulas and different formats:

=($B1-$A1)<31
=($B1-$A1)>=31

WBD
 
Upvote 0
Untested

Select the range to highlight

Conditional Formatting
New Rule
Use a formula to determine...

=(B$1-A$1)>=31 format as red
=(B$1-A$1)<31 format as amber
=(B$1-A$1)<=26 format as green

Format as required
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,721
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top