Conditional formatting of block of data

excel-rob

Board Regular
Joined
Feb 24, 2009
Messages
58
Hi,

I'm trying to format each row in a block of data based on the entries in one column. So for example, in row 2, if cell E2 contains the words "complete" or "N/A", I want the text in all the columns in row 2 to be grey. Then the same with row 3, but with reference to E3, and so on.

Conditional highlighting seems the obvious choice, so I highlighted A2:E1000 and then put this formula into conditional highlighting:

=IF(OR(E2="complete",E2="N/A"),1,0)

and chose font colour grey.

This works, but only applies the formatting to column A. How do I get it to apply it to all the columns that I highlighted?

Thanks in advance for any help.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
42,153
Office Version
365
Platform
Windows
You shouldn't need the IF part of the formula and you do need an absolute reference to column E, hence the $ signs. Try

=OR($E2="complete",$E2="N/A")
 

excel-rob

Board Regular
Joined
Feb 24, 2009
Messages
58
Thanks, that works great. Of course I didn't need the OR, it already gives a binary response :oops:

Why do you need the $ on the tested column out of interest?

Thanks.
 

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,283
Thanks, that works great. Of course I didn't need the OR, it already gives a binary response :oops:

Why do you need the $ on the tested column out of interest?

Thanks.
the $E2 tells excel to keep looking in column E even if you move the formula left and right.
for example if you put a reference to E2 in column A and then copy it to B it will change the ref. to F2
i don't know if i succeded to explain it :rolleyes:
 

excel-rob

Board Regular
Joined
Feb 24, 2009
Messages
58
Sorry, didn't explain myself very clearly. I know what the $ does in the normal way you just describe. I just don't understand when it changes the behaviour of conditional highlighting in the way described above...
 

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,283
Sorry, didn't explain myself very clearly. I know what the $ does in the normal way you just describe. I just don't understand when it changes the behaviour of conditional highlighting in the way described above...
it does not change the formatting - it only fixes the location of the condition
 

Special-K99

Well-known Member
Joined
Nov 7, 2006
Messages
8,327
Works exactly the same way.

"...I'm trying to format each row in a block of data based on the entries in one column..."

So regardless of the column of the cell in the row you are formatting
every cell in that row needs to be based on that one column
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
42,153
Office Version
365
Platform
Windows
Of course I didn't need the OR, it already gives a binary response
You DO need the OR if you are testing for either "complete" or "N/A". What you didn't need was the IF function.
 

Forum statistics

Threads
1,081,441
Messages
5,358,694
Members
400,508
Latest member
fish31

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top