Conditional Formatting (CF Rule) Using INDIRECT Function

zero269

Active Member
Joined
Jan 16, 2023
Messages
253
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm having some trouble getting a Conditional Formatting Rule to work using the INDIRECT function.

I'm using a formula within the Table for testing in column 'C'.
Column 'E' - outside the Table - was converted to use the INDIRECT function to work from outside the Table.
Columns A:B are formatted as Dates.

Both formulas produce the same results correctly, but using the formula in 'E' is not conditionally formatting the dates in 'A' that are greater than it's corresponding 'Due Date' in column 'B'.

I avoid using cell references when I can as my Table data may shift at times. Using INDIRECT prevents the formula from breaking if a new column is added or rearranged within the Table.

Any help on this would be greatly appreciated.

VBA Testing.xlsm
ABCDE
1CF Applied to:FormulaCF Rule using INDIRECT
2Test DateDue DateIF Test > Due
322-Jan30-Jan FALSE
431-Jan30-JanOverdueTRUE
524-Jan30-Jan FALSE
625-Jan30-Jan FALSE
726-Jan30-Jan FALSE
Indirect-Dates
Cell Formulas
RangeFormula
E3:E7E3=IF(ISNUMBER(INDIRECT("t_Indirect[Test Date]")),INDIRECT("t_Indirect[Test Date]") > INDIRECT("t_Indirect[Due Date]"),"")
C3:C7C3=IF(ISNUMBER([@[Test Date]]),IF([@[Test Date]] > [@[Due Date]],"Overdue",""),"")
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A3:A7Expression=IF(ISNUMBER(INDIRECT("t_Indirect[Test Date]")),INDIRECT("t_Indirect[Test Date]") > INDIRECT("t_Indirect[Due Date]"),"")textNO
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
How about
Excel Formula:
=AND(ISNUMBER(INDIRECT("t_Indirect[@[Test Date]]")),INDIRECT("t_Indirect[@[Test Date]]") > INDIRECT("t_Indirect[@[Due Date]]"))
 
Upvote 1
Solution
How about
Excel Formula:
=AND(ISNUMBER(INDIRECT("t_Indirect[@[Test Date]]")),INDIRECT("t_Indirect[@[Test Date]]") > INDIRECT("t_Indirect[@[Due Date]]"))
Thanks for saving me again Fluff,

It works like a charm. I can't believe I still have such a hard time wrapping my head around what functions to use and when.

Is it safe to say that the IF function is not really - if ever - a viable CF Rule solution?

VBA Testing.xlsm
ABC
2Test DateDue DateIF Test > Due
322-Jan30-Jan 
431-Jan30-JanOverdue
524-Jan30-Jan 
625-Jan30-Jan 
726-Jan30-Jan 
Indirect-Dates
Cell Formulas
RangeFormula
C3:C7C3=IF(ISNUMBER([@[Test Date]]),IF([@[Test Date]] > [@[Due Date]],"Overdue",""),"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A3:A7Expression=AND(ISNUMBER(INDIRECT("t_Indirect[@[Test Date]]")),INDIRECT("t_Indirect[@[Test Date]]") > INDIRECT("t_Indirect[@[Due Date]]"))textNO
 
Upvote 0
You do not need to use IF in CF as the CF just needs a true or false response.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,929
Messages
6,175,460
Members
452,644
Latest member
gjcase

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