conditional formatting of cell and adjacent cells

kristian97

New Member
Joined
Nov 12, 2019
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hello.

I want to format cell in which is text "Martin" (C10) and also two cells on the left of the cell with "Martin" (A10:B10).
Expectation:
1698137720477.png


With formula
=C2="Martin"
I am able to format only 2nd cell to the right of cell containing "Martin".
1698137736752.png



When I change formula to
=A2="Martin"
then cell with Martin is formatted but not 2 cells on the left of it.
1698137749454.png


I am using "Applies to" range
=$A$2:$I$32

I know how to do it for all 3 cells when I use separate ranges for groups of 3 columns, but I need to use it with only one range.

Sorry, I cannot install XL2BB Add-in :/ Hopefully explanation with pictures will be enough.

Thank you.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

See if this is what you want. You would select A2:I32 and apply the Conditional Formatting shown.

23 10 24.xlsm
ABCDEFGHI
1
21a1a1a
32b2b2b
43c3c3c
54d4d4d
65e5e5eMartin
76f6f6f
87g7g7g
98h8h8h
109iMartin9i9i
1110j10j10j
1211k11k11k
1312l12l12l
1413m13m13m
1514n14n14n
1615o15oMartin15o
1716p16p16p
1817q17q17q
1918r18r18rMartin
2019s19s19s
2120t20t20t
2221u21u21u
2322v22v22v
2423w23w23w
2524x24x24x
2625y25y25y
2726z26zMartin26z
2827aa27aa27aa
2928ab28ab28ab
3029ac29ac29ac
3130ad30ad30ad
3231ae31ae31ae
CF
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:I32Expression=SEARCH("|Martin|","|"&A2&"|"&B2&"|"&C2&"|")textNO


or a second (probably simpler) option

23 10 24.xlsm
ABCDEFGHI
1
21a1a1a
32b2b2b
43c3c3c
54d4d4d
65e5e5eMartin
76f6f6f
87g7g7g
98h8h8h
109iMartin9i9i
1110j10j10j
1211k11k11k
1312l12l12l
1413m13m13m
1514n14n14n
1615o15oMartin15o
1716p16p16p
1817q17q17q
1918r18r18rMartin
2019s19s19s
2120t20t20t
2221u21u21u
2322v22v22v
2423w23w23w
2524x24x24x
2625y25y25y
2726z26zMartin26z
2827aa27aa27aa
2928ab28ab28ab
3029ac29ac29ac
3130ad30ad30ad
3231ae31ae31ae
CF (2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:I32Expression=OR(A2="Martin",B2="Martin",C2="Martin")textNO
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

See if this is what you want. You would select A2:I32 and apply the Conditional Formatting shown.

23 10 24.xlsm
ABCDEFGHI
1
21a1a1a
32b2b2b
43c3c3c
54d4d4d
65e5e5eMartin
76f6f6f
87g7g7g
98h8h8h
109iMartin9i9i
1110j10j10j
1211k11k11k
1312l12l12l
1413m13m13m
1514n14n14n
1615o15oMartin15o
1716p16p16p
1817q17q17q
1918r18r18rMartin
2019s19s19s
2120t20t20t
2221u21u21u
2322v22v22v
2423w23w23w
2524x24x24x
2625y25y25y
2726z26zMartin26z
2827aa27aa27aa
2928ab28ab28ab
3029ac29ac29ac
3130ad30ad30ad
3231ae31ae31ae
CF
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:I32Expression=SEARCH("|Martin|","|"&A2&"|"&B2&"|"&C2&"|")textNO


or a second (probably simpler) option

23 10 24.xlsm
ABCDEFGHI
1
21a1a1a
32b2b2b
43c3c3c
54d4d4d
65e5e5eMartin
76f6f6f
87g7g7g
98h8h8h
109iMartin9i9i
1110j10j10j
1211k11k11k
1312l12l12l
1413m13m13m
1514n14n14n
1615o15oMartin15o
1716p16p16p
1817q17q17q
1918r18r18rMartin
2019s19s19s
2120t20t20t
2221u21u21u
2322v22v22v
2423w23w23w
2524x24x24x
2625y25y25y
2726z26zMartin26z
2827aa27aa27aa
2928ab28ab28ab
3029ac29ac29ac
3130ad30ad30ad
3231ae31ae31ae
CF (2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:I32Expression=OR(A2="Martin",B2="Martin",C2="Martin")textNO
Hello Peter, thank you for your reply.
I would like apply it for a lot more columns than in the example so unfortunately

=SEARCH("|Martin|","|"&A2&"|"&B2&"|"&C2&"|")
or
=OR(A2="Martin",B2="Martin",C2="Martin")

would not be feasible formulas to use due to manual input of columns.

How would you suggest to implement it in a dynamic way?
 
Upvote 0
Thanks for updating your version details.

I would like apply it for a lot more columns
Do you mean that there are more than 3 columns in each section? If so, consider this option.

23 10 24.xlsm
ABCDEFGHIJKLMNO
21a1a1a
32b2b2b
43c3c3c
54d4d4d
65e5e5eMartin
76f6f6f
87g7g7g
98h8h8h
109iMartin9i9i
1110j10j10j
1211k11k11k
1312l12l12l
1413m13m13m
1514n14n14n
1615o15oMartin15o
1716p16p16p
1817q17q17q
1918r18r18rMartin
2019s19s19s
2120t20t20t
2221u21u21u
2322v22v22v
2423w23w23w
2524x24x24x
2625y25y25y
2726z26zMartin26z
2827aa27aa27aa
2928ab28ab28ab
3029ac29ac29ac
3130ad30ad30ad
3231ae31ae31ae
CF (3)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:O32Expression=OR(A2:E2="Martin")textNO
 
Upvote 1
Solution
Thanks for updating your version details.


Do you mean that there are more than 3 columns in each section? If so, consider this option.

23 10 24.xlsm
ABCDEFGHIJKLMNO
21a1a1a
32b2b2b
43c3c3c
54d4d4d
65e5e5eMartin
76f6f6f
87g7g7g
98h8h8h
109iMartin9i9i
1110j10j10j
1211k11k11k
1312l12l12l
1413m13m13m
1514n14n14n
1615o15oMartin15o
1716p16p16p
1817q17q17q
1918r18r18rMartin
2019s19s19s
2120t20t20t
2221u21u21u
2322v22v22v
2423w23w23w
2524x24x24x
2625y25y25y
2726z26zMartin26z
2827aa27aa27aa
2928ab28ab28ab
3029ac29ac29ac
3130ad30ad30ad
3231ae31ae31ae
CF (3)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:O32Expression=OR(A2:E2="Martin")textNO
I mean that I will have multiple groups of 3 columns like ABC, DEF, GHI, JKL, MNO,..., where in the 3rd column (C,F,I,L,O,...) "Martin" can be selected.

However, you have provided me the right solution for this problem, I have updated it as following:
1698157285558.png


Thank you!
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,684
Members
449,116
Latest member
HypnoFant

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