简体   繁体   English

仅显示 excel 图表中日期之间的数据

[英]Show only data between dates in excel chart

I have yearly.net profit data that uses spill formulas in Columns A and B and in columns D and EI have used start and end date selectors in G2 and I2 to gather the subset of data for the chart.我有 yearly.net 利润数据,在 A 列和 B 列以及 D 列和 EI 中使用溢出公式,在 G2 和 I2 中使用开始和结束日期选择器来收集图表的数据子集。

The chart data has the Net Profit data range set to ='Yearly Net Profit':$E$2:$E$35 and the years are set to ='Yearly Net Profit':$D$2:$D$35 .图表数据的净利润数据范围设置为='Yearly Net Profit':$E$2:$E$35并且年份设置为='Yearly Net Profit':$D$2:$D$35

As you can see from the image below, the chart graphs all the blank space from D10 onwards which I don't want.从下图中可以看出,图表绘制了 D10 之后的所有空白区域,这是我不想要的。

净利润图

I tried using ='Yearly Net Profit'!$E$2# but unfortunately it doesn't like this.我尝试使用='Yearly Net Profit'!$E$2#但不幸的是它不喜欢这样。

I then added two entries in to the Name Manager, one for YearsForYearlyNetProfitFiltered set to ='Yearly Net Profit'!$D$2# and the second YearyNetProfitFiltered set to ='Yearly Net Profit'!$E$2# .然后我在名称管理器中添加了两个条目,一个YearsForYearlyNetProfitFiltered设置为='Yearly Net Profit'!$D$2# ,第二个YearyNetProfitFiltered设置为='Yearly Net Profit'!$E$2#

I re-selected the data for the chart, so Net Profit data became ='Yearly Net Profit'!YearyNetProfitFiltered and the Years became ='Yearly Net Profit'!YearsForYearlyNetProfitFiltered .我重新选择了图表的数据,因此 Net Profit 数据变为='Yearly Net Profit'!YearyNetProfitFiltered并且 Years 变为='Yearly Net Profit'!YearsForYearlyNetProfitFiltered

Unfortunately this results in only one entry being visible, see image below:不幸的是,这导致只有一个条目可见,请参见下图:

在此处输入图像描述

You'll see in cells N and OI have output the named ranges.您会在单元格 N 和 OI 中看到 output 命名范围。 Why would the named ranges only have one entry?为什么命名范围只有一个条目?

I am not sure whether you are looking to create a dynamic chart or not, but you may try to follow the steps as is mentioned.我不确定您是否要创建动态图表,但您可以尝试按照提到的步骤进行操作。

在此处输入图像描述


A Quick Gif on the dynamic chart动态图表上的快速 Gif

在此处输入图像描述


Steps:脚步:

  1. Select the data, and from Insert Tab --> Under Charts Group --> Click Insert Column Or Bar Chart --> Select 2D Clustered Column Select 数据,然后从Insert选项卡 --> 在Charts组下 --> 单击Insert Column Or Bar Chart --> Select 2D Clustered Column
  2. Now, create two formulas one for the YEAR and another for the NETPROFIT现在,创建两个公式,一个用于YEAR ,另一个用于NETPROFIT

• Formula for YEAR • 年YEAR

=INDEX($A$2:$A$24,MATCH($D$2,$A$2:$A$24,0)):INDEX($A$2:$A$24,MATCH($F$2,$A$2:$A$24,0))

• Formula for NETPROFIT NETPROFIT

=INDEX($B$2:$B$24,MATCH($D$2,$A$2:$A$24,0)):INDEX($B$2:$B$24,MATCH($F$2,$A$2:$A$24,0))

  1. Copy the formulas and place in Name Manager by defining the respective names for each.通过为每个公式定义各自的名称来复制公式并放置在Name Manager中。 Like as below:像下面这样:

在此处输入图像描述

  1. Next, select the chart, Chart Design --> Select Data接下来,select 图表, Chart Design --> Select Data
  2. Under Legend Entries Series , Click On the Series of Net Profit --> Click Edit , a new window opens as Edit SeriesLegend Entries Series下,单击Net Profit系列 --> 单击Edit ,一个新的 window 打开为Edit Series

在此处输入图像描述

  1. In Series Values remove everything except the sheet name and press F3 (Function Key) and select NETPROFIT from Paste NamesSeries Values中删除工作表名称以外的所有内容,然后按F3 (功能键)和 select NETPROFITPaste Names

在此处输入图像描述

  1. Like wise from Horizontal (Category Axis Labels) click on edit and do the same as above in bullet 6就像Horizontal (Category Axis Labels)中的明智一样,单击编辑并在项目符号 6 中执行与上面相同的操作

在此处输入图像描述

  1. Press Ok, to return back to Excel. Change the Start Year & End Year to see the changes you need it will show only the data from the range of years shown in the cells D2 & F2 .按确定,返回到 Excel。更改Start YearEnd Year以查看您需要的更改,它将仅显示单元格D2F2中显示的年份范围内的数据。

Note: I have used Millions as display units for Y-Axis .注意:我使用Millions作为Y-Axis的显示单位。 Here is a copy of the workbook这是工作簿的副本


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

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