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.
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
43,476
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,331
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,331
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,341
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
43,476
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,089,491
Messages
5,408,592
Members
403,216
Latest member
Boba Fetts

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top