grozhd
grozhd

Reputation: 501

chart in excel with user data selection

I have data like this:

    Date         1st var     2nd var      ....  nth var    benchmark
  01.01.1999      1.1         2.03                3.1          1.7
  05.01.1999      1.2         2.01                3.07         1.5

I need to do the following: I want to plot one of the variables and the benchmark on the same chart. But I need a possibility of selecting variable and date range, so chart would auto-update. Selection may be done by entering limits in cells, or selecting from drop-down lists.

For now column length is fixed (somewhere around 1500 values). But after doing this, I am planning on making it auto-update when a new row of data is inserted.

I am new to excel and know a little of VBA. I plotted two graphs on one chart using excel chart manager but I don't know how to (or is it even possible) add data selection.

1) Is it possible to do this only using excel built-in functions? If yes, should I do this within excel or VBA? Which way is better?

2) If writing an answer is too long or the best method would be too complicated for me to understand, could you please advise me a reference to read?

Thanks a lot!

Upvotes: 2

Views: 1547

Answers (2)

Jon Peltier
Jon Peltier

Reputation: 6053

I blogged about a technique that presented the user with a combobox (dropdown) which had the names of all possible columns that could be plotted. Only one of them was plotted, but the user could use the combo to select which one was plotted. Check out Interactive Multiple Line Chart in Excel.

Upvotes: 0

Jook
Jook

Reputation: 4682

I would recommend, that you play around with filters, because you can plot charts with filtered data. Also you can setup a chart with dataseries for all of your data and selectively hide those you don't need by hiding the columns in your data sheet.

Those should be like the easiest attempts and they auto update your chart.

Further you may want to read about named ranges, as they ease complexity in charts with many dataseries.

As an example, try this:

Make a chart with two data series - (data1,benchmarks),(data2,benchmarks) - use the whole columns. Then filter your data to a desired date-range. Then hide the column with data2.

edit

When you have (too) many dataseries, you can create a subset of selective columns and use those for your chart.

Use this formula and paste it down with your data:

XZ2=INDEX(B2:XY2,1,$XZ$1)

Now your data would be between column B and XY, and you can select your desired column by setting e.g. XZ1 = 1, which in this case would select coulmn B and thereby making XZ2=B2.

Upvotes: 1

Related Questions