Another Conditional Format issue

TryingToLearn

Well-known Member
Joined
Sep 10, 2003
Messages
730
Excel Home & Office 2016 on Win 10

Column B is formatted y-mmm
Column F text is either "", "x" or "+" and this formula works if placed in a worksheet cell on row 13:

=IF(AND(F13="",DAY(B13)<TODAY()-5),"True","False")

Shows True if F13 is within 5 days of today

If I place the guts of it in conditional formatting for a given cell on row 13 it does not work.

AND(F13="",DAY(B13)<TODAY()-5)

What could I be missing?

TIA
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
You have something like this:


<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:52.28px;" /><col style="width:76.04px;" /><col style="width:18.06px;" /><col style="width:18.06px;" /><col style="width:18.06px;" /><col style="width:40.87px;" /><col style="width:187.25px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td><td >D</td><td >E</td><td >F</td><td >G</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td><td > </td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >6</td><td > </td><td style="text-align:right; ">04-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">FALSO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >7</td><td > </td><td style="text-align:right; ">05-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">FALSO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >8</td><td > </td><td style="text-align:right; ">06-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">FALSO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >9</td><td > </td><td style="text-align:right; ">07-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">VERDADERO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >10</td><td > </td><td style="text-align:right; ">08-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">VERDADERO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >11</td><td > </td><td style="text-align:right; ">09-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">VERDADERO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >12</td><td > </td><td style="text-align:right; ">10-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">VERDADERO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >13</td><td > </td><td style="text-align:right; ">11-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">VERDADERO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >14</td><td > </td><td style="text-align:right; ">12-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">VERDADERO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >15</td><td > </td><td style="text-align:right; ">13-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">VERDADERO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >16</td><td > </td><td style="text-align:right; ">14-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">VERDADERO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >17</td><td > </td><td style="text-align:right; ">15-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">VERDADERO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >18</td><td > </td><td style="text-align:right; ">16-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">FALSO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >19</td><td > </td><td style="text-align:right; ">17-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">FALSO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >20</td><td > </td><td style="text-align:right; ">18-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">FALSO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >21</td><td > </td><td style="text-align:right; ">19-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">FALSO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >22</td><td > </td><td style="text-align:right; ">20-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">FALSO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >23</td><td > </td><td style="text-align:right; ">21-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">FALSO</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >24</td><td > </td><td style="text-align:right; ">22-jun</td><td > </td><td > </td><td > </td><td > </td><td style="text-align:right; ">FALSO</td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >G6</td><td >=IF(AND(F6="",B6<TODAY()+5,B6>TODAY()-5),TRUE,FALSE)</td></tr></table></td></tr></table>


Your formula is not complete because the edit truncated part of it.
For your formula to be complete you have to put a space before and after each sign > or < .

=IF(AND(F13="",DAY(B13)<today()-5),"true","false")
</today()-5),"true","false")

For example:
=IF(AND(F6="",B6 < TODAY()+5,B6 > TODAY()-5),TRUE,FALSE)
 
Upvote 0
=IF(AND(F13="",DAY(B13)<today()-5),"true","false")
</today()-5),"true","false")
Your formula is incomplete. My guess is it is being chopped off because you are using > or < signs that are treated as HTML code.
Try posting your formula again, but put spaces on both sides of all > and < signs, and it should work.
 
Upvote 0
<today()-5),"true","false")
<today()-5)
If you want the specific row range to be formatted with Conditional formatting then set it experiment with the absolute address.
eg.
Rich (BB code):
=IF(AND($F13...
try
Code:
=IF(AND([B]$[/B]F13="", DAY(B13) "less then" TODAY()) ,TRUE,FALSE)
<today(),true,false)<today();true;false) <today()="" ,true,false)
<today()),true,false)[ code]
or</today()),true,false)[></today(),true,false)<today();true;false)></today()-5)></today()-5),"true","false")
<today()-5),"true","false")
<today()-5)
<today(),true,false)<today();true;false) <today()="" ,true,false)
<today()),true,false)[ code]
<today())<today())<today())<today())[ code]
just AND formula

Sign "less then" without quote.

</today())<today())<today())<today())[></today()),true,false)[></today(),true,false)<today();true;false)></today()-5)></today()-5),"true","false")
I do not know why Forum cut off part of formula?
Probably also cut you off?
 
Last edited:
Upvote 0
Excel Home & Office 2016 on Win 10

Column B is formatted y-mmm
Column F text is either "", "x" or "+" and this formula works if placed in a worksheet cell on row 13:

=IF(AND(F13="",DAY(B13)<TODAY()-5),"True","False")

Shows True if F13 is within 5 days of today

If I place the guts of it in conditional formatting for a given cell on row 13 it does not work.

AND(F13="",DAY(B13) < TODAY()-5)

What could I be missing?

TIA

my apologies, I cut off part of the first formula by not using the code functions so it should have read:
Code:
=IF(AND(F13="",DAY(B13) < TODAY()-5),"True","False")

Which DOES WORK PROPERLY if placed in a cell on the sheet. I will be using this on entire columns which is why I did not use an absolute address.

within the conditional formatting section rule I placed:
Code:
 AND(F13="",DAY(B13) < TODAY()-5)

Which does NOT work as hoped. However! It dawned on me the formula is not correct for what I am trying to do. To have the background of the cells turn red if within 5 days of today I should have used:
Code:
AND(F413="",DAY(B413) > DAY(TODAY())-5)
which works as intended.
Thank you for your comments.
 
Upvote 0
Note:
Even on the spreadsheet (and not in Conditional Formatting), this:
Code:
=IF(AND(F13="",DAY(B13) < TODAY()-5),"True","False")
can just be written like this:
Code:
=AND(F13="",DAY(B13) < TODAY()-5))
as AND and OR statement return boolean values (so the IF part is totally unnecessary, if you are just looking to return True or False).
 
Upvote 0
my apologies, I cut off part of the first formula by not using the code functions so it should have read:
Code:
=IF(AND(F13="",DAY(B13) < TODAY()-5),"True","False")

Which DOES WORK PROPERLY if placed in a cell on the sheet. I will be using this on entire columns which is why I did not use an absolute address.

within the conditional formatting section rule I placed:
Code:
 AND(F13="",DAY(B13) < TODAY()-5)

Which does NOT work as hoped. However! It dawned on me the formula is not correct for what I am trying to do. To have the background of the cells turn red if within 5 days of today I should have used:
Code:
AND(F413="",DAY(B413) > DAY(TODAY())-5)
which works as intended.
Thank you for your comments.

If in B you have a date, you do not need a reference to the day. Can be:

=AND(F6="",B6 > HOY()+5)


But, I'm confused, your formula works?


If not, you could give examples of what you have and what cells you want in red.
 
Upvote 0
If in B you have a date, you do not need a reference to the day. Can be:

=AND(F6="",B6 > HOY()+5)


But, I'm confused, your formula works?


If not, you could give examples of what you have and what cells you want in red.

The last code posted works. what I want is to highlight cells in red if, today, they are within 5 days of the due date in col B.

Thanks for your reply.
 
Upvote 0
The last code posted works. what I want is to highlight cells in red if, today, they are within 5 days of the due date in col B.

Thanks for your reply.

I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,050
Members
449,206
Latest member
Healthydogs

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