How to apply changing conditional formatting to an array of columns

Jaylo801

New Member
Joined
Feb 18, 2024
Messages
7
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Hello,
I am trying to apply conditional formatting to an array of data. Specifically, if data in a specific column g7:g87 is equal to the text value in g5, I want it to be green with green writing. I can easily do this for this one column. But actually I would like the same formatting to apply to columns H to AT, with the row numbers staying the same, while the column changes, so that the formatting applies to each individual column. Of course I can do this formatting operation 40 times but I'm hoping there is a quicker and easier way to do this.
 

Attachments

  • Excel query.PNG
    Excel query.PNG
    9 KB · Views: 10

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".
Welcome to the MrExcel board!

Try this
  1. Remove that existing Conditional Formatting
  2. Select G7:AT87
  3. Conditional Formatting -> New rule .. -> Use a formula to determine which cells to format -> Format values where this formula is true: =$G7=$G$5 -> Format .. -> choose your formatting -> OK -> OK
 
Upvote 0
Welcome to the MrExcel board!

Try this
  1. Remove that existing Conditional Formatting
  2. Select G7:AT87
  3. Conditional Formatting -> New rule .. -> Use a formula to determine which cells to format -> Format values where this formula is true: =$G7=$G$5 -> Format .. -> choose your formatting -> OK -> OK
Thanks, that is moving in the right direction but maybe needs a tweak - now if the rule is true for the first column, it has applied across the rows. Would it be better to be =$g7=$g5
 
Upvote 0
Thanks, that is moving in the right direction but maybe needs a tweak - now if the rule is true for the first column, it has applied across the rows. Would it be better to be =$g7=$g5
Actually that doesn't seem to work either. Here's what I have now, when I want the cell to be green if it matches the yellow cell, but the text value in the yellow cell changes for each column.
 

Attachments

  • Excel query2.PNG
    Excel query2.PNG
    14.3 KB · Views: 9
Upvote 0
Sorry, I mis-interpreted what you wanted. Try the steps above again but with this formula.

=G7=G$5
 
Upvote 0
Sorry, I mis-interpreted what you wanted. Try the steps above again but with this formula.

=G7=G$5
Thank you that does seem to work. My only issue now is that it has not applied to all of the columns. It worked G-K and P-R, T, AD, AM, and AQ but not the other columns. I'm guessing that is not a problem with the formula but something else?
 
Upvote 0
Did you follow the steps exactly?

Can you post a small section of the sheet, including some columns that are not working as expected with XL2BB instead of just an image? That way we should be able to work out what the issue is.

Here is a small section of my dummy worksheet

24 02 19.xlsm
GHIJKLMNO
5abcdefghi
6Hdr1Hdr2Hdr3Hdr4Hdr5Hdr6Hdr7Hdr8Hdr9
7abcdef
8bhi
9cee
10dee
11a
12c
13a
14a
CF
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G7:AT87Expression=G7=G$5textNO
 
Upvote 0
Reading Power Up 2024 BEFORE Test .xlsx
GHIJKLMNOP
5C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA. Emu. A. She had broken a bone.B. It helped her to be brave. C. confident. D. to cook the damper without burning herself
6C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA.Emu. B.She had an itchy rash on her skin.B.It helped her to be brave. C.confident. D. to cook the damper without burning herself
7B. electricityC. the copper and icebox.B. letter.B. the seaC. pouredA. Emu. B. She had an itchy rash on her skin.D. She wanted Emu Oil on her leg. B. worried. C. to watch it hover over the coals
8C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedD. Great Emu. B. She had an itchy rash on her skin.B. It helped her to be brave. B. worried. A. to set it on fire
9C. wood firesD. lights and radios.B. letter.B. the seaC. pouredC. Milky Way. C. She was born with a stiff, weak leg.A. It made her cry in bed. B. worried. B. to poke the fire with it
10C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA. Emu. A. She had broken a bone.B. It helped her to be brave. C. confident. D. to cook the damper without burning herself
11C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedD. Great Emu. B. She had an itchy rash on her skin.B. It helped her to be brave. C. confident. D. to cook the damper without burning herself
12C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA. Emu. A. She had broken a bone.B. It helped her to be brave. C. confident. D. to cook the damper without burning herself
13C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA. Emu. A. She had broken a bone.A. It made her cry in bed. A. angry. A. to set it on fire
14C. wood firesD. lights and radios.B. letter.D. the environmentB. stirredB. Emu Oil. A. She had broken a bone.B. It helped her to be brave. B. worried. A. to set it on fire
15C. wood firesD. lights and radios.B. letter.B. the seaD. rubbedA. Emu. A. She had broken a bone.B. It helped her to be brave. C. confident. C. to watch it hover over the coals
16C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedD. Great Emu. C. She was born with a stiff, weak leg.B. It helped her to be brave. C. confident. B. to poke the fire with it
17C. wood firesC. the copper and icebox.B. letter.D. the environmentD. rubbedA. Emu. B. She had an itchy rash on her skin.D. She wanted Emu Oil on her leg. B. worried. B. to poke the fire with it
18C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA. Emu. B. She had an itchy rash on her skin.D. She wanted Emu Oil on her leg. B. worried. B. to poke the fire with it
19B. electricityD. lights and radios.B. letter.D. the environmentD. rubbedA. Emu. B. She had an itchy rash on her skin.B. It helped her to be brave. C. confident. B. to poke the fire with it
20C. wood firesC. the copper and icebox.B. letter.B. the seaB. stirredB. Emu Oil. A. She had broken a bone.A. It made her cry in bed. B. worried. C. to watch it hover over the coals
21C. wood firesB. fridges and washing machines.B. letter.D. the environmentB. stirredB. Emu Oil. D. She wanted to run like Cathy Freeman.B. It helped her to be brave. A. angry. A. to set it on fire
Stage 3 test LEVELS
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G7:AT87Expression=G7=G$5textNO

Hope that works - I put a section of the sheet with the columns that appeared as I hoped and some columns that were not following the conditional formatting.
 
Upvote 0
Thanks for that. Seems to be working from what I can see. I assume that you are wondering about cells like L7?
L7 is not the same as L5 because L7 has a lot of spaces between A. and Emu whereas L5 does not. Therefore L7 is not formatted.

Best thing would be to tidy the actual data, but if you are forced to work with the data as it is, perhaps this would suffice.

24 02 19.xlsm
GHIJKLMN
5C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA. Emu. A. She had broken a bone.B. It helped her to be brave.
6C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA.Emu. B.She had an itchy rash on her skin.B.It helped her to be brave.
7B. electricityC. the copper and icebox.B. letter.B. the seaC. pouredA. Emu. B. She had an itchy rash on her skin.D. She wanted Emu Oil on her leg.
8C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedD. Great Emu. B. She had an itchy rash on her skin.B. It helped her to be brave.
9C. wood firesD. lights and radios.B. letter.B. the seaC. pouredC. Milky Way. C. She was born with a stiff, weak leg.A. It made her cry in bed.
10C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA. Emu. A. She had broken a bone.B. It helped her to be brave.
11C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedD. Great Emu. B. She had an itchy rash on her skin.B. It helped her to be brave.
12C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA. Emu. A. She had broken a bone.B. It helped her to be brave.
CF (2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G7:P21Expression=TRIM(G7)=TRIM(G$5)textNO
 
Upvote 0
Or if this is really all about the correct multiple choice options then perhaps this which just checks the first character.

24 02 19.xlsm
GHIJKLMN
5C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA. Emu. A. She had broken a bone.B. It helped her to be brave.
6C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA.Emu. B.She had an itchy rash on her skin.B.It helped her to be brave.
7B. electricityC. the copper and icebox.B. letter.B. the seaC. pouredA. Emu. B. She had an itchy rash on her skin.D. She wanted Emu Oil on her leg.
8C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedD. Great Emu. B. She had an itchy rash on her skin.B. It helped her to be brave.
9C. wood firesD. lights and radios.B. letter.B. the seaC. pouredC. Milky Way. C. She was born with a stiff, weak leg.A. It made her cry in bed.
10C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA. Emu. A. She had broken a bone.B. It helped her to be brave.
11C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedD. Great Emu. B. She had an itchy rash on her skin.B. It helped her to be brave.
12C. wood firesD. lights and radios.B. letter.D. the environmentD. rubbedA. Emu. A. She had broken a bone.B. It helped her to be brave.
CF (3)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G7:P21Expression=LEFT(G7,1) = LEFT(G$5,1)textNO
 
Upvote 0
Solution

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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