conditional formatting for changing cell

rzml

New Member
Joined
Dec 24, 2020
Messages
40
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I Use this =OR((MOD(O2,10)=3),(MOD(O2,10)=4),(MOD(O2,10)=8),(MOD(O2,10)=9))
conditional formatting equation to highlight cells with 3,4,8 and 9 in the ones position. but the equation is fixed on the O. Is there a way the equation will change depending on the selected cells?

testing vba.xlsx
M
1Total
20
347
449
558
656
769
876
954
1082
1167
1262
1359
1458
1576
1659
1775
1856
1948
2071
2194
2278
2379
2468
2563
2673
2791
2876
2997
3063
3198
3286
3394
3479
3567
3683
3781
3883
3974
4074
4182
4274
4382
4493
4560
Sheet1 (2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
M2Expression=OR((MOD(activecell,10)=3),(MOD(activecell,10)=4),(MOD(activecell,10)=8),(MOD(activecell,10)=9))textNO


thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
that will move depending on the selection
As you start at ROW 2 - then the selection needs to start at row 2

If you wanted Column O to column S and Rows 2 to 1000
then select O2:S1000
then the formula will look at those cells

NOTE to fix the column you need a $

so $O2 fixed the column to O
 
Upvote 0
thanks for the answer but I can't use O2:S1000 since it will contain other information. I can't fix it to O using $ since it can change
the only thing I can use is the header ie "Total".
 
Upvote 0
I have setup a simple example where 1 will be highlighted , BUT only on a column that has Total in Row1
So this may do you

=AND( O$1="Total",OR((MOD(O1,10)=3),(MOD(O1,10)=4),(MOD(O1,10)=8),(MOD(O1,10)=9)))
But I'm not sure what your range of columns are - lets say it was possible to be A to Z
Then select A to Z
and use
=AND( A$1="Total",OR((MOD(A1,10)=3),(MOD(A1,10)=4),(MOD(A1,10)=8),(MOD(A1,10)=9)))

But I assume the sheet changes somehow for the column to change , and so you may need VBA

Book1
ABCD
1XYTotalZ
21111
3
411
5
6312
7
8
91
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A:DExpression=AND(A$1="Total", A1=1)textNO
 
Upvote 0
Solution
I have setup a simple example where 1 will be highlighted , BUT only on a column that has Total in Row1
So this may do you

=AND( O$1="Total",OR((MOD(O1,10)=3),(MOD(O1,10)=4),(MOD(O1,10)=8),(MOD(O1,10)=9)))
But I'm not sure what your range of columns are - lets say it was possible to be A to Z
Then select A to Z
and use
=AND( A$1="Total",OR((MOD(A1,10)=3),(MOD(A1,10)=4),(MOD(A1,10)=8),(MOD(A1,10)=9)))

But I assume the sheet changes somehow for the column to change , and so you may need VBA

Book1
ABCD
1XYTotalZ
21111
3
411
5
6312
7
8
91
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A:DExpression=AND(A$1="Total", A1=1)textNO
Thanks, Etaf that worked fine with me.
 
Upvote 0

Forum statistics

Threads
1,214,854
Messages
6,121,941
Members
449,056
Latest member
denissimo

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