Conditional formatting a range which is dynamic

Formula11

Active Member
Joined
Mar 1, 2005
Messages
468
Office Version
  1. 365
Platform
  1. Windows
How can I apply conditional formatting to a range which is dynamic.
The start cell is known.
The end row is the last non blank row, in the example below, 14.
The last column is the last non blank column, in this case, G.


1666008790829.png
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
i notice you do have blank rows
how about

=COUNTA($A1:$J10000)<>0

Change J10000 to the maxium number of cells ever likely to have text in

Book2
ABCDEFGHIJ
1
2
3
4text
5
6
7text
8
9text
10tex
11ff
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Sheet2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:J25Expression=COUNTA($A1:$J10000)<>0textYES
 
Upvote 0
ok,
so change the selected range to A to F
and the formula
=COUNTA($A1:$F10000)<>0



Book2
ABCDEFGHIJ
1
2
3
4text
5
6
7text
8
9text
10tex
11ff
12
13
14
15
16
17
18
19
20ttt
Sheet2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:F100000Expression=COUNTA($A1:$F10000)<>0textYES



for 2007, 2010 , 2013 , 2016 , 2019 or 365 Subscription excel version
Conditional Formatting

Highlight applicable range >>
A1:F10000 - Change, reduce or extend the rows to meet your data range of rows

Home Tab >> Styles >> Conditional Formatting
New Rule >> Use a formula to determine which cells to format
Edit the Rule Description: Format values where this formula is true:
=COUNTA($A1:$F10000)<>0

Format [Number, Font, Border, Fill]
choose the format you would like to apply when the condition is true
OK >> OK
 
Upvote 0
Thanks for letting me know, but the range is always changing, adding text, deleting text, adding rows/columns, deleting rows/columns.
The last row and column are 2 variables.
 
Upvote 0
OK, so on your example column G has TEXT in , but you say it should only goto to F
Thanks, but above should stop at column F.
I suspect you may need VBA to actually dynamically set the range , that th ecionditional formatting is selecting to use - otherwise you may need to apply to a much bigger range - like A1:AZ100000 or larger

What version of Excel are you applying too
 
Upvote 0
I understand but I have mentioned it's dynamic, so in my example I pointed out G is the last column, in yours F is the last column.
OK I will look at using VBA then.
Thanks.
 
Upvote 0

Forum statistics

Threads
1,224,808
Messages
6,181,073
Members
453,020
Latest member
mattg2448

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