4

Ok, so I am using excel 2007, and am trying to do some fairly complicated conditional formatting. Consider the following:

=1=1 

Highlights the cell.

=INDIRECT(ADDRESS(2,COLUMN()))=5

Highlights cells in a column where the second row has 5 in it.

=AND(1=1,2=2)

Highlights the cell.

=AND(INDIRECT(ADDRESS(2,COLUMN()))=5,1=1)

Highlights nothing?

It seems that any complicated things I can do simply don't work. Even when the expression evaluates true when put into the cell directly, it doesn't always make the formatting work correctly. Has anybody else experienced this? Anybody have a workaround?

1
  • This is still a problem in Excel 2013 Commented Oct 21, 2014 at 16:38

2 Answers 2

3

I get the same results on Excel 2003. Even your second example (which is missing the "=" BTW) has strange behaviour, since not all the cells in the column are highlighted until I minimize and restore the window.

I was able to get it to work by defining a name "foo" as "=INDIRECT(ADDRESS(2,COLUMN())" and then using "=AND(foo=5,1=1)" for the condition.

To define a name, use Insert->Name->Define, type "foo" (or whatever) in the Name box, and the formula in the Refers To box. Normally a named range refers to a fixed cell, but it can also refer to a constant, a formula, a range, etc. See Chip Pearson's site for details.

Sign up to request clarification or add additional context in comments.

3 Comments

named variables? Sounds great, but I've never done that before. I'm kinda new to excel. How do you declare foo?
I'd assumed you were more Excel-savvy than me given your use of complex conditional formatting! :-) I've added more detail.
Thanks! I'm good at fudging formulas, but don't know how to do many practical things. Decomposing the formula into smaller names seems to make this work.
0

In Excel 2007, it would not accept my conditional format of

=AND(expr1, expr2)

where expr1 and expr2 were fairly complicated.

Just by adding an extra comparison, it started taking it.

=TRUE = AND(expr1, expr2)

I suspect it is validating for the presence of some basic operator, and it would not accept the condition without it.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.