Dynamic chart (using dynamic range?)

jcooooper

Board Regular
Joined
Mar 24, 2018
Messages
74
Office Version
  1. 365
Platform
  1. Windows
Hi all,

In the below data set, I have four data series (Region 1, Region 2, Sector 1, Sector 2) with varying starting dates. The date range will grow over time as a new column is added each month.

What i'm trying to do is build a function where I can select any of these data series, with say a radio button or similar, and a dynamic chart is populated. using the relevant start date, and end date.

I imagine the first step is creating a dynamic range for each of the 4, which I've struggled with. I've tried using the OFFSET, MATCH then COUNT backwards from the current weight column when creating the width, but couldn't figure it out.

Any help would be greatly appreciated. I've added a picture and also a table below.


1630788710109.png


Asset AllocationNov 2020Dec 20202021Feb 2021Mar 2021Apr 2021May 2021Jun 2021Jul 2021Current weight
Region 1100.0%
North America54.7%53.4%54.3%49.9%52.9%50.8%47.2%49.1%57.2%49.9%
Emerging Markets16.8%18.1%20.1%18.7%15.4%15.5%16.9%15.7%11.6%18.7%
Europe ex UK12.6%12.7%12.2%14.4%16.6%18.5%20.3%17.7%16.8%14.4%
United Kingdom4.9%5.6%5.4%5.3%5.9%5.9%6.0%6.2%5.5%5.3%
Japan1.1%1.1%1.1%1.0%1.3%1.3%0.0%0.2%-0.5%1.0%
Asia Pacific ex Japan5.9%5.6%5.7%5.2%4.3%3.4%2.6%2.5%3.0%5.2%
Region 2
North America44.4%45.4%45.7%51.7%51.8%49.7%52.8%64.2%45.7%
Emerging Markets21.0%23.8%22.2%14.8%15.1%18.9%19.1%10.9%22.2%
Europe ex UK11.4%8.4%10.6%14.1%17.1%19.9%15.2%13.8%10.6%
UK5.2%4.8%4.9%6.1%5.9%6.5%7.2%6.3%4.9%
Japan2.7%2.6%2.4%2.9%2.7%-0.5%0.1%-1.6%2.4%
Asia Pacific ex JP15.4%15.1%14.1%10.3%7.5%5.4%5.6%6.6%14.1%
Sector 1
Consumer Discretionary12.2%12.9%12.5%13.5%13.4%11.9%11.9%12.9%
Communication Services9.7%9.8%10.7%11.3%11.8%11.2%12.0%9.8%
Consumer Staples3.9%3.8%4.1%4.4%4.7%4.2%4.9%3.8%
Energy6.0%7.2%7.0%2.5%2.6%2.3%2.1%7.2%
Financials17.9%19.1%14.8%14.5%15.1%21.7%14.1%19.1%
Health Care5.2%4.9%6.8%6.2%5.4%5.4%7.4%4.9%
Industrials3.1%3.4%4.1%4.8%4.4%4.1%4.9%3.4%
Information Technology20.2%20.6%19.5%21.4%21.5%21.1%23.6%20.6%
Materials2.0%2.2%2.1%2.1%1.6%1.4%1.4%2.2%
Real Estate15.3%11.8%12.8%13.8%13.4%11.6%12.2%11.8%
Utilities4.4%4.5%5.5%5.5%6.0%5.2%5.3%4.5%
Sector 2
Communication Services14.0%13.5%
Consumer Discretionary9.0%11.3%
Consumer Staples3.5%4.4%
Energy12.6%2.5%
Financials24.0%14.5%
Health Care7.2%6.2%
Industrials9.4%4.8%
Information Technology2.7%21.4%
Materials6.4%2.1%
Real Estate6.4%13.8%
Utilities4.9%5.5%
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
no answer since yesterday so I'll jump in even though Excel is not my forte'. Maybe the only thing I can do is show what worked for me for a stacked chart long ago when the range was vertical:
=OFFSET(DATA!$B$6,0,0,COUNTA(DATA!$B:$B),1) which was a range at the scope of worksheet

I had other ranges at the workbook level as well. All I can recall about that is that there is a difference, so maybe that's part of why you say 'didn't work' (which doesn't give away too much info). Here's one that also seems to be vertical:
=OFFSET(TradeCounts!$B$3:$J$3,0,0,COUNTA(TradeCounts!$J:$J))

This is where I got most of my code from with respect to selecting ranges in code (plus the rest of what I needed for Automation, which is how I got the data from Access into the sheets):

Maybe with the Offset syntax above you can figure out how to make the range offset horizontally. It's probably very obvious to some, but I'd have to study these functions/formulae again. Access is my thing - not so much Excel.
HTH.
 
Upvote 0

Forum statistics

Threads
1,214,385
Messages
6,119,209
Members
448,874
Latest member
b1step2far

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