简体   繁体   English

Excel中的图表,带有用户数据选择

[英]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). 目前,列长度是固定的(大约1500个值)。 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. 我是新手,并且对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. 我使用excel图表管理器在一张图表上绘制了两个图形,但是我不知道如何(甚至可能)添加数据选择。

1) Is it possible to do this only using excel built-in functions? 1)是否可以仅使用excel内置函数来执行此操作? If yes, should I do this within excel or VBA? 如果是,我应该在excel或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? 2)如果写答案的时间太长,或者最好的方法对我来说太复杂了,请问您可以参考一下吗?

Thanks a lot! 非常感谢!

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. 使用两个数据系列制作一个图表-(data1,benchmarks),(data2,benchmarks)-使用整个列。 Then filter your data to a desired date-range. 然后将数据过滤到所需的日期范围。 Then hide the column with data2. 然后用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 eg XZ1 = 1 , which in this case would select coulmn B and thereby making XZ2=B2 . 现在,您的数据将在B列和XY列之间,并且您可以通过设置XZ1 = 1来选择所需的列,在这种情况下,该列将选择库伦B,从而使XZ2=B2

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 . 在Excel中签出交互式多线图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM