Merging two formulas for use in conditional formatting

maximillianrg

Board Regular
Joined
Aug 7, 2014
Messages
74
Office Version
  1. 2016
Platform
  1. Windows
Thank you for your help in advance

I'm trying to figure out how apply conditional formatting to a date in cell J49 bases on two factors, the date in cell J49 and the contents of cell A49, here is the logic. In the below examples, bad means conditional formatting would be applied (the date would be changed to RED), and good means conditional formatting would not be applied (the date would be black or default)
  • =IF(AND(A49=0,J49<>TODAY()),"bad","good") so if today is 2/6 and the date in cell J49 is not 2/6 AND cell A49 = 0 conditional formatting would be applied
  • =IF(AND(A49="",TODAY()-J49>2,"bad","good") so if today is 2/6 and the date in cell J49 was 2/4 or earlier conditional formatting would be applied
So what I'm trying to do is combine and modify the two formulas into one so that conditional formatting would be applied to the date in cell J49 based on those formulas

Thoughts?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Try this

=AND(TODAY()-J49>=2,OR(A49="",A49=0),J49<>"")
 
Upvote 0
Just use an OR condition to check for either of the combinations that return bad, i.e.
=OR(AND(A49=0,J49<>TODAY()),AND(A49="",TODAY()-J49>2))
 
Upvote 0
Hello Joe and Dante - Thank you for your comments. I tried both formulas by doing the following and both produced the same results, cell J49 was highlighted green regardless of the date in cell J9 or the cell of value in cell A49

  1. Select Cell J49, select conditional formatting, select "use a formula to select which cells to format
  2. Copy formula into formula field, click format button, select fill color green
  3. Press OK on Fill color box and OK on new formula rule
 
Upvote 0
Please give us an actual example that is not working for you - please provide concrete examples of values in cells A49 and J49 (note that J9 was not part of the question).
 
Upvote 0
Note that my original formula should do the EXACT same thing as your original formulas did. So, if there is an issue my formula, there is probably as issue with your formula (it probably isn't working like you thought it was).

As matter as fact, I think I see a problem with it.
=IF(AND(A49="",TODAY()-J49>2,"bad","good") so if today is 2/6 and the date in cell J49 was 2/4 or earlier conditional formatting would be applied
That is a false statement. The difference between 2/6 and 2/4 is EXCACTLY 2 days. So your formula will NOT return "bad" unless you change it to >=2

Since I based my formula off of your original formula (assuming it was correct), we would need to change also to:
=OR(AND(A49=0,J49<>TODAY()),AND(A49="",TODAY()-J49>=2))
 
Upvote 0
cell J49 was highlighted green regardless of the date in cell J9 or the cell of value in cell A49

Here I show you the possibilities according to your rules.

1581106519642.png


If that is not what you need, you could give examples.
Forget your formulas a bit and explain with examples in which cases you want to paint highlight the cell.
 
Upvote 0
Gentlemen - I truly want to thank you for your help. The below image captures the conditional formatting affects I am trying to achieve.


highlight.PNG
 
Upvote 0
Try this:

=AND(TODAY()-J49>=0,TODAY()-J49<=2,OR(A49="",A49=0))
 
Upvote 0

Forum statistics

Threads
1,214,865
Messages
6,121,988
Members
449,060
Latest member
mtsheetz

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