Probably impossible conditional formating

Front

Board Regular
Joined
Oct 26, 2021
Messages
54
Office Version
  1. 2016
Platform
  1. Windows
I think this might be impossible. After trying to figure it out for a couple of hours I thought I would ask people much better than myself at excel.

I am attempting to use conditional formatting to change a cell a color if contains conditions that are true.

In the target cell I will have a future date and perhaps an acronym following the date. For example, it would be one of the three:

12/15/21 BMO
12/15/21 AMC
12/15/21

BMO means before market open, so that actually means that date should count for one day sooner, so it should technically count as 12/14/21. AMC means after market close, so this should count as that day. However, it’s just the date, we don’t know if it’s BMO or AMC, so it should put up a color warning for both or if that is an issue count as just BMO.

I want to put up the color warning one week before that date. I was thinking something like this

=AND(ISNUMBER(SEARCH($AE$39,Z3)),ISBLANK(P3))

Where AE39 is the current date and Z3 is the target cell, but that only works for one date. Plus that does not work for the acronyms. I thought to do a range for the date like this

F3>=$AE$27,F3<=$AE$30

but then the acronym runes that. I’m about rate to scrap the idea and do something inferior, but I thought a check your first.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
See how you get on with this. There was no clarification of ISBLANK(P3) in your post so I've just added that back in as a separate criteria from the dates.
Excel Formula:
=AND(ISBLANK(P3),OR(N(Z3)-$AE$39=ROW(INDIRECT("1:7")),IFERROR(DATEVALUE(SUBSTITUTE(Z3," BMO",""))-1-$AE$39=ROW(INDIRECT("1:7")),0),IFERROR(DATEVALUE(SUBSTITUTE(Z3," AMC",""))-$AE$39=ROW(INDIRECT("1:7")),0)))
 
Upvote 0
Thank you, it didn't work but I'll look into what you did see if I can figure it out.
 
Upvote 0
Try it without the ISBLANK part, does it work then?

The formula does what you've asked for but I did notice a lack if consistency in your references (Z3 or F3, AE39,AE27 or AE30)?
 
Last edited:
Upvote 0
With the current date of 15/11/21 in AE39, this is what I get. Note that I'm using UK format dates, but it will work the same with any dates that are in the correct format for your region.
Book1
Z
315/12/21 BMO
415/12/21 AMC
515/12/2021
615/11/21 BMO
715/11/21 AMC
815/11/2021
916/11/21 BMO
1016/11/21 AMC
1116/11/2021
1217/11/21 BMO
1317/11/21 AMC
1417/11/2021
1518/11/21 BMO
1618/11/21 AMC
1718/11/2021
1819/11/21 BMO
1919/11/21 AMC
2019/11/2021
2120/11/21 BMO
2220/11/21 AMC
2320/11/2021
2421/11/21 BMO
2521/11/21 AMC
2621/11/2021
2722/11/21 BMO
2822/11/21 AMC
2922/11/2021
3023/11/21 BMO
3123/11/21 AMC
3223/11/2021
3324/11/21 BMO
3424/11/21 AMC
3524/11/2021
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
Z3:Z35Expression=AND(ISBLANK(P3),OR(N(Z3)-$AE$39=ROW(INDIRECT("1:7")),IFERROR(DATEVALUE(SUBSTITUTE(Z3," BMO",""))-1-$AE$39=ROW(INDIRECT("1:7")),0),IFERROR(DATEVALUE(SUBSTITUTE(Z3," AMC",""))-$AE$39=ROW(INDIRECT("1:7")),0)))textNO
 
Upvote 0
Thank you! I had to change something on my end to get it working, but was able to get it. Very impressive how you can whip something out like that in no time.
 
Upvote 0
I need one more conditional formatting. The above worked great for a week out, but I need to do a different color for one day out. I thought I could just edit the above formula, but this is one I just dont understand. So I wrote a new one because its only looking for one day.

Excel Formula:
=OR(Y3=TEXT(TODAY()+1,"m/d/y")&" BMO",Y3=TEXT(TODAY(),"m/d/y")&" AMC",Y3=TODAY()+1,Y3=TODAY())

It works fine, but there is one problem. Even though I have the cell format set to a 2 digit year, if I have the date in there, then later add BMO or AMC after the date it changes to a four digit year and then does not work. This does not happen with the formula you did for me. Is there a way to fix it so the date does not update, or can you please convert that formula you did for me above to the one day version?
 
Upvote 0
edited post:- totally misread what was asked ?

"m/d/y" in your text functions is going to look for 2 digit year, with month and day omitting any leading zero's. Changing that to "mm/dd/yyyy" should work.
 
Upvote 0
That does not work as all the other dates are in two digit years, so change to mm/dd/yyyy would break those. What I really need is for excel to not update the year from two digits to four, but I dont think that's possible. The other option is for the conditional formatting to not care if its two or four. I suppose what I could do is just add two more or statements with the four digit year format, so it checks for both.
 
Upvote 0
Yep that worked, it looks sucky but it worked. Thank you!
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,428
Members
449,083
Latest member
Ava19

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