Dynamic conditional formatting based on cell values?

Joined
Jul 27, 2017
Messages
24
Hi all,

I think this is a conditional formatting issue, but I am unsure. To add some complexity, I have to insert a new column each week to provide historical context, so the formula cannot just reference column C vs. column D - the formula has to move with the insertion of new columns. The formatting should be based on comparing cells between two columns, but again these columns change based on the date. Below are example tables to help clarify:

02/19 Table
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]ID[/TD]
[TD="align: center"]2/05 Status[/TD]
[TD="align: center"]2/12 Status[/TD]
[TD="align: center"]Current Status[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Open[/TD]
[TD]ReTest[/TD]
[TD]Closed[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Open[/TD]
[TD]Closed[/TD]
[TD]Closed[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Open[/TD]
[TD]ReTest[/TD]
[TD]ReOpen[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Open[/TD]
[TD]ReTest[/TD]
[TD]ReTest[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Open[/TD]
[TD]ReTest[/TD]
[TD]Open[/TD]
[/TR]
</tbody>[/TABLE]

02/26 Status
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]ID[/TD]
[TD="align: center"]02/05 Status[/TD]
[TD="align: center"]02/12 Status[/TD]
[TD="align: center"]02/19 Status[/TD]
[TD="align: center"]Current Status[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Open[/TD]
[TD]ReTest[/TD]
[TD]Closed[/TD]
[TD]Closed[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Open[/TD]
[TD]Closed[/TD]
[TD]Closed[/TD]
[TD]Closed[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Open[/TD]
[TD]ReTest[/TD]
[TD]ReOpen[/TD]
[TD]Closed[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Open[/TD]
[TD]ReTest[/TD]
[TD]ReTest[/TD]
[TD]ReOpen[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Open[/TD]
[TD]ReTest[/TD]
[TD]Open[/TD]
[TD]Closed[/TD]
[/TR]
</tbody>[/TABLE]

On the 02/19 Status Table, I would like to highlight the cells in the "Current Status" column if the 2/12 Status is ReTest and then the Current Status is Closed or ReOpen. Then, when I update the table on 2/26 (to the 02/26 Status Table), I need the new "Current Status" column cells to be highlighted based on those same conditions, except now I need to highlight the Current Status column cells if the 02/19 Status is ReTest and Current Status is either ReOpen or Closed.

Can this be done in Conditional formatting? Or do I need to add some VBA code? Or can I put in a formula into another column that returns a value, then highlights my "Current Status" column based on that value? Should I be using cell name to provide references for the formula?

Any assistance or direction you all can provide on this would be greatly appreciated! Thank you in advance!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Maybe...
Assumes data in columns A:D, headers in row 1

Select D2:D6 and in Conditional Formatting use this formula
=AND(OR(D2="Closed",D2="ReOpen"),OFFSET(D2,0,-1)="Retest")
pick the format you want

M.
 
Last edited:
Upvote 0
Hey Marcelo,

That worked beautifully, thank you!!! My one question is if there is a way to only highlight the cell under the current status column - utilizing the formula you provided allows me to highlight any cells that fit the status change criteria, but it highlights any cells that fit those criteria across multiple columns, not just the cells in my "Current Status" column. Is there a way I can add an additional condition to the formula to only highlight cells if they are within the column with the header "Current Status"?

Thanks!
 
Upvote 0
You are welcome. Glad to help.

About your question:
I'm afraid i'm not understanding what you're saying/asking. In my tests only the cells in the Current Status column were highlighted - provided the conditions were fulfilled, of course.

M.
 
Upvote 0
So if my table on 02/19 looks like the below table, I want just the cells in the Current Status column to be highlighted in red. So for this example, only cells D2 and D4 would be highlighted in Red.
02/19 Table
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]ID[/TD]
[TD="align: center"]2/05 Status[/TD]
[TD="align: center"]2/12 Status[/TD]
[TD="align: center"]Current Status[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Open[/TD]
[TD]ReTest[/TD]
[TD]Closed[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Open[/TD]
[TD]Closed[/TD]
[TD]Closed[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Open[/TD]
[TD]ReTest[/TD]
[TD]ReOpen[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Open[/TD]
[TD]ReTest[/TD]
[TD]ReTest[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Open[/TD]
[TD]ReTest[/TD]
[TD]Open[/TD]
[/TR]
</tbody>[/TABLE]

But then the next week I need to add in a new column to the left of my Current Status column, copy over the statuses from the old "Current Status" column to the 02/19 Status column, and input the newest statuses in Column E. Once this is done, i only want the cells in column E (my new Current Status column) to be highlighted.

02/26 Status
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]ID[/TD]
[TD="align: center"]02/05 Status[/TD]
[TD="align: center"]02/12 Status[/TD]
[TD="align: center"]02/19 Status[/TD]
[TD="align: center"]Current Status[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Open (no format)[/TD]
[TD]ReTest (no format)[/TD]
[TD]Closed (blue fill)[/TD]
[TD]Closed (blue fill)[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Open (no format)[/TD]
[TD]Closed (blue fill)[/TD]
[TD]Closed (blue fill)[/TD]
[TD]Closed (blue fill)[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Open (no format)[/TD]
[TD]ReTest (no format)[/TD]
[TD]ReOpen (no format)[/TD]
[TD]Closed (blue fill)[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Open (no format)[/TD]
[TD]ReTest (no format)[/TD]
[TD]ReTest (no format)[/TD]
[TD]ReOpen (red fill)[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Open (no format)[/TD]
[TD]ReTest (no format)[/TD]
[TD]Open (no format)[/TD]
[TD]Closed (blue fill)[/TD]
[/TR]
</tbody>[/TABLE]

I have additional formatting on this table as well - if the cell says "Closed" then it is highlighted in Blue, if it is "Open", "ReOpen", or "ReTest" then it has no formatting applied to it. So, on the 02/26 Status table I am showing, I would only want cell E5 to be highlighted in red.

Any thoughts on how to do that with the formula you provided? Am I perhaps applying the formatting to the incorrect range?
 
Upvote 0
You should copy (Current Status) and paste only values in the column to the left.
Otherwise the conditional formatting will be copied to the new column.

The same when copying/pasting the new column (02/19 Status) to Current Status.
Otherwise, the conditional formatting of the Current Status column will be erased.

I have to leave now. Hope this helps.

M.
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,636
Members
452,662
Latest member
Aman1997

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