Dynamically adding and updating Conditional Formatting with a Named Range

naquinn

Board Regular
Joined
Mar 5, 2009
Messages
55
Hello,

I have a column of numbers with dates alongside. I can control a chart dynamically using the following named ranges:


This first one allows me to add to my dates (A), so the list grows over time
DATE
=OFFSET(Sheet1!$A$3,0,0,COUNTA(Sheet1!$A:$A)-1,1)

Next the DATE named range feeds into this INDEX and MATCH array so the chart axis can be controlled by two data validation drop down lists
DATE_CHART
=INDEX(DATE,MATCH(Sheet1!$D$3,DATE,0)):INDEX(DATE,MATCH(Sheet1!$E$3,DATE,0))

Same process for the totals column (B)
TOTALS
=OFFSET(Sheet1!$B$3,0,0,COUNTA(Sheet1!$B:$B)-1,1)

...and
TOTALS_CHART
=INDEX(TOTALS,MATCH(Sheet1!$D$3,DATE,0)):INDEX(TOTALS,MATCH(Sheet1!$E$3,DATE,0))

By adding the DATE named range to the list section of the data validation box for cells D3 and E3 I can grow my list of data over time and dynamically control the chart with the two drop down list cells. The new entries in column A get added to the list via the COUNTA function.

Thankyou for reading this so far.... now this is the bit I have gotten stuck with.

I wanted to add a conditional formatting rule. Two scale colour to the B column. The idea being it acts like a kind of vertical mini heat map showing me at a glance the highs and lows on a scale across the different numbers in the column.

However, I'm having problems making it work dynamically, in a similar way to how the named ranges make my chart dynamic.

I have tried adding the TOTALS_CHART as a named range to the "applies to" box in the conditional formatting rules manager. Excel does accept the named range, and gives me a graded scale based on the array defined by cells D3 and E3 from how they are currently setup. So that does work, however, it doesn't update further when the D3 and E3 cells are changed.

Also, if I then add a new entry at the bottom of the list to columns A and B (a new date and totals number) the conditional formatting doesn't pick that up at all, even though the TOTALS_CHART named range has been entered into the conditional formatting manager for column B.

If anyone might be able to help, or point me in the right direction, I'd be very grateful. Been playing around with it all day and I'm not sure what else to try.

Many thanks


Conditional Formatting.xlsx
ABCDEFGHIJKL
1
2DATETOTALSSTART DATEEND DATE
321/01/2021163,01528/01/202117/02/2021
422/01/2021190,423
523/01/2021133,823
624/01/2021107,328
725/01/202174,433
826/01/2021-28,331
927/01/2021-70,584
1028/01/2021-82,001
1129/01/2021-68,808
1230/01/2021-80,825
1331/01/2021-115,426
1401/02/2021-78,949
1502/02/2021-21,417
1603/02/2021-7,268
1704/02/202150,213
1805/02/202174,295
1906/02/2021100,137
2007/02/2021112,096
2108/02/2021-7,081
2209/02/2021-7,281
2310/02/2021370
2411/02/202112,060
2512/02/2021-9,341
2613/02/2021-9,503
2714/02/2021-20,139
2815/02/202120,837
2916/02/202138,246
3017/02/202115,613
31
32
33
Sheet1
Cell Formulas
RangeFormula
A4:A30A4=SUM(A3+1)
Named Ranges
NameRefers ToCells
DATE=OFFSET(Sheet1!$A$3,0,0,COUNTA(Sheet1!$A:$A)-1,1)A4
DATE_CHART=INDEX(DATE,MATCH(Sheet1!$D$3,DATE,0)):INDEX(DATE,MATCH(Sheet1!$E$3,DATE,0))A11
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B10:B30Other TypeColor scaleNO
Cells with Data Validation
CellAllowCriteria
D3:E3List=DATE
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,143,839
Messages
5,721,096
Members
422,339
Latest member
SHIVATVM

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
Top