How to Highlight 'n' rows and 'n' columns, using conditional formatting

fourdragons

New Member
Joined
Mar 18, 2019
Messages
8
Hi,

I am trying to achieve the output as shown in the image. Wanted to dynamically highlight cells based on the number of rows and columns, using conditional formatting. Given that min value is 1 and max is 50 allowed in cells E4 and F4. Please can anyone help me with this.?

Thanks in advance
 

Attachments

  • conditional formatting.jpg
    conditional formatting.jpg
    96.2 KB · Views: 8

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hi & welcome to MrExcel.
How about
+Fluff 1.xlsm
DEFGHIJKLMNOPQRSTUVWXY
1123456789101112131415
21
32
415103
54
65
76
87
98
109
1110
1211
1312
1413
1514
1615
1716
1817
1918
2019
2120
2221
2322
2423
2524
2625
2726
2827
2928
3029
3130
3231
3332
Main
Cell Formulas
RangeFormula
K1:BH1K1=SEQUENCE(,50)
J2:J51J2=SEQUENCE(50)
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
K2:BH51Expression=AND(ROWS(K$2:K2)<=$E$4,COLUMNS($K2:K2)<=$F$4)textNO


Ignore the formulae in row 1 & column J
 
Upvote 0
Select K2:Y20, go to Format>Conditional formatting..., select Use formula to determine cells to format and enter this formula,
Excel Formula:
=AND(ROWS(K$2:K2)<=$E$4,COLUMNS($K2:K2)<=$F$4)
and format as required.
 
Upvote 0
Thanks Norie
Hi & welcome to MrExcel.
How about
+Fluff 1.xlsm
DEFGHIJKLMNOPQRSTUVWXY
1123456789101112131415
21
32
415103
54
65
76
87
98
109
1110
1211
1312
1413
1514
1615
1716
1817
1918
2019
2120
2221
2322
2423
2524
2625
2726
2827
2928
3029
3130
3231
3332
Main
Cell Formulas
RangeFormula
K1:BH1K1=SEQUENCE(,50)
J2:J51J2=SEQUENCE(50)
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
K2:BH51Expression=AND(ROWS(K$2:K2)<=$E$4,COLUMNS($K2:K2)<=$F$4)textNO


Ignore the formulae in row 1 & column J
Thank you Fluff, its working.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Select K2:Y20, go to Format>Conditional formatting..., select Use formula to determine cells to format and enter this formula,
Excel Formula:
=AND(ROWS(K$2:K2)<=$E$4,COLUMNS($K2:K2)<=$F$4)
and format as required.
Thanks Norie, its working.
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,039
Members
449,063
Latest member
ak94

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