Conditionally formatting a row with relative references doesn't work!?

jdmc45

Board Regular
Joined
May 8, 2011
Messages
146
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am trying to conditionally format an entire row (and all subsequent rows) based on a criterion for the first cell to be one of either of three text values, say "a", "b" or "c". When the formatting is done however with relative references only the first cell (which the criterion is based on) is highlighted. How do I get the whole row to be conditionally formatting, with relative references, as I want to use the format painter to copy down the formats?

If someone tells me how to add the spreadsheet to a post I will include the spreadsheet which I'm sure will take one of you a matter of seconds to figure out.

Thanks!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi,

I am trying to conditionally format an entire row (and all subsequent rows) based on a criterion for the first cell to be one of either of three text values, say "a", "b" or "c". When the formatting is done however with relative references only the first cell (which the criterion is based on) is highlighted. How do I get the whole row to be conditionally formatting, with relative references, as I want to use the format painter to copy down the formats?

If someone tells me how to add the spreadsheet to a post I will include the spreadsheet which I'm sure will take one of you a matter of seconds to figure out.

Thanks!
Just apply the formatting all at once.

What version of Excel are you using?
 
Upvote 0
=and(a1="a") in the conditional format formula might work. I had to do the same for "b", & "c" too. When copied down it worked for me.
 
Upvote 0
That didn't work. I'm using 2007. How do I add the spreadsheet to a post?
 
Upvote 0
That didn't work. I'm using 2007. How do I add the spreadsheet to a post?
You can't attach a file to a post.

Try this...

Let's assume you want to format the rows in the range A1:D5 if the cell in column A = A or B or C.

Select the *entire* range A1:D5 starting from cell A1. Cell A1 will be the active cell. The active cell is the one cell in the selected range that is not shaded. The formula will be relative to the active cell.
  • Goto the Home tab>Styles>Conditional Formatting>Manage rules>New rule>Use a formula to determine which cells to format
  • Enter this formula in the box below:
  • =OR($A1="A",$A1="B",$A1="C")
  • Click the Format button
  • Select the desired style(s)
  • OK out
 
Last edited:
Upvote 0
Sorry I think my explanation was poor. I would like the rows to be coloured different colours according to whether the leftmost cell of the row is a or b or c. So for example, blue for a, green for b and yellow for c. Then this format can be applied to the whole data set. My apologies for that.
Any help is appreciated. J
 
Upvote 0
based on your last post. If you select A1 to D5, and create the following 3 different conditional formatting formulas in A1, I think is what you are looking for.
=AND($a1="a") format blue
=AND($A1="b") format green
=AND($A1="c") format yellow
Then if you highlight D1:D5 and copy it down all of the formats will follow.
 
Last edited:
Upvote 0
Sorry I think my explanation was poor. I would like the rows to be coloured different colours according to whether the leftmost cell of the row is a or b or c. So for example, blue for a, green for b and yellow for c. Then this format can be applied to the whole data set. My apologies for that.
Any help is appreciated. J
OK, not a problem.

Select the *entire* range A1:D5 starting from cell A1. Cell A1 will be the active cell. The active cell is the one cell in the selected range that is not shaded. The formula will be relative to the active cell.
  • Goto the Home tab>Styles>Conditional Formatting>Manage rules>New rule>Use a formula to determine which cells to format
  • Enter this formula in the box below:
  • =$A1="A"
  • Click the Format button
  • Select the Fill tab
  • Select a shade of BLUE
  • OK>OK
  • New Rule
  • Use a formula to determine which cells to format
  • Enter this formula in the box below:
  • =$A1="B"
  • Click the Format button
  • Select the Fill tab
  • Select a shade of GREEN
  • OK>OK
  • New Rule
  • Use a formula to determine which cells to format
  • Enter this formula in the box below:
  • =$A1="C"
  • Click the Format button
  • Select the Fill tab
  • Select a shade of YELLOW
  • OK out
 
Upvote 0
based on your last post. If you select A1 to D5, and create the following 3 different conditional formatting formulas in A1, I think is what you are looking for.
=AND($a1="a") format blue
=AND($A1="b") format green
=AND($A1="c") format yellow
Then if you highlight D1:D5 and copy it down all of the formats will follow.

Mr. Bill Thanks for that, it was the AND function that was needed for it to apply to the entire row, cheers!
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,896
Members
452,948
Latest member
Dupuhini

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