热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

excel图表配合下拉菜单_从下拉列表中选择Excel图表日期

excel图表配合下拉菜单Insteadofshowingallthedatainachart,youcanselectaspecificdaterange,andshowonly

excel图表配合下拉菜单

Instead of showing all the data in a chart, you can select a specific date range, and show only the data from that period. In this example, drop down lists of dates are created with data validation. Select Excel chart dates from a drop down list, and the chart changes to show the new range.

您可以选择一个特定的日期范围,而仅显示该期间的数据,而不是在图表中显示所有数据。 在此示例中,日期下拉列表是通过数据验证创建的。 从下拉列表中选择Excel图表日期,图表将更改以显示新范围。

《excel图表配合下拉菜单_从下拉列表中选择Excel图表日期》

To create this dynamic chart in Excel 2007, you can create a table from the chart data, then create named ranges, and use those names in the chart.

若要在Excel 2007中创建此动态图表,可以从图表数据中创建一个表,然后创建命名范围,并在图表中使用这些名称。

为图表数据创建Excel表 (Create an Excel Table for the Chart Data)

[Note: Please see the post, Problems With Dynamic Charts in Excel and ignore this step — the Excel Table may cause problems.]

[ 注意 :请参阅“ Excel中的动态图表问题”一文,而忽略此步骤-Excel表可能会引起问题。]

  1. On the Chart sheet, select a cell in the chart data, e.g. cell A1

    在图表工作表上,在图表数据中选择一个单元格,例如单元格A1

  2. On the Ribbon, click the Insert tab, then click Table

    在功能区上,单击“插入”选项卡,然后单击“表”。

  3. In the Create Table dialog box, click OK, to create the table for the selected range.

    在“创建表”对话框中,单击“确定”,以为所选范围创建表。

《excel图表配合下拉菜单_从下拉列表中选择Excel图表日期》

命名开始日期和结束日期单元格 (Name the Start Date and End Date cells)

  1. On the Chart sheet, select the Start Date cell (F17)

    在图表工作表上,选择开始日期单元格(F17)

  2. In the Name box, type StartDate then press Enter, to name the cell

    在“名称”框中,键入StartDate,然后按Enter,以命名该单元格

  3. Select the End Date cell I17, and in the Name Box type EndDate, then press Enter

    选择“结束日期”单元格I17,然后在“名称框”中键入EndDate,然后按Enter。

《excel图表配合下拉菜单_从下拉列表中选择Excel图表日期》

命名图表日期范围 (Name the Chart Date Range)

[Note: Because you did not create an Excel Table, as advised above, use the following formula in step 3, to create a dynamic range for the ChartDates: =OFFSET(Chart!$A$1,1,0,COUNT(Chart!$A:$A),1)

[ 注意 :因为没有按照上面的建议创建Excel表,所以在步骤3中使用以下公式为ChartDates创建动态范围:= OFFSET(Chart!$ A $ 1,1,0,COUNT(Chart! $ A:$ A),1)

  1. On the Ribbon, click the Formulas tab, then click Define Name

    在功能区上,单击“公式”选项卡,然后单击“定义名称”

  2. Type ChartDates as the name for the range

    键入ChartDates作为范围的名称

  3. Click in the Refers To box, and select the Chart Dates (A2:A23) on the worksheet.

    单击“引用到”框,然后在工作表上选择“图表日期”(A2:A23)。

    Because this range is in an Excel Table, the reference will automatically change to show the

    由于此范围位于Excel表中,因此引用将自动更改为显示

    table name and column name, Table1[Date]

    表名和列名,Table1 [Date]

  4. Click OK

    点击确定

《excel图表配合下拉菜单_从下拉列表中选择Excel图表日期》

创建开始日期和结束日期下拉菜单 (Create the Start Date and End Date dropdowns)

  1. On the Chart sheet, select the Start Date cell (F17)

    在图表工作表上,选择开始日期单元格(F17)

  2. On the Ribbon, click the Data tab, then click Data Validation

    在功能区上,单击“数据”选项卡,然后单击“数据验证”

  3. From the Allow dropdown, select List

    从“允许”下拉列表中,选择“列表”

  4. In the Formula box type: =ChartDates

    在“公式”框中,键入:= ChartDates

  5. Click OK, then repeat these steps to create a dropdown for the End Date.

    单击“确定”,然后重复这些步骤以创建“结束日期”下拉列表。

《excel图表配合下拉菜单_从下拉列表中选择Excel图表日期》

定义X和Y值的命名范围: (Define the named ranges for X and Y values:)

  1. On the Ribbon, click the Formulas tab, then click Define Name

    在功能区上,单击“公式”选项卡,然后单击“定义名称”

  2. Type a name for the series: XValues

    键入系列的名称:XValues

  3. From the Scope dropdown, select the data sheet name, Chart

    从范围下拉列表中,选择数据表名称,图表

  4. Type a formula that finds the start and end dates in the data:

    输入一个可在数据中找到开始和结束日期的公式:

    =OFFSET(Chart!$A$2,MATCH(StartDate,ChartDates,0)-1,0,

    = OFFSET(图表!$ A $ 2,MATCH(StartDate,ChartDates,0)-1,0,

    MATCH(EndDate,ChartDates,0)-

    MATCH(EndDate,ChartDates,0)-

    MATCH(StartDate,ChartDates,0)+1,1)

    匹配(StartDate,ChartDates,0)+1,1)

  5. Click OK

    点击确定

  6. Follow the same steps to define the YValues named range, using the following Settings:

    使用以下设置,按照相同的步骤定义YValues命名范围:

    Name: Yvalues

    名称:Yvalues

    Scope: Chart

    范围:图表

    Refers To: =OFFSET(Chart!XValues,0,1)

    引用:= OFFSET(Chart!XValues,0,1)

《excel图表配合下拉菜单_从下拉列表中选择Excel图表日期》

创建图表 (Create the chart)

  1. Select a cell in the chart data

    在图表数据中选择一个单元格

  2. On the Ribbon, click Insert, then click Line in the Charts group

    在功能区上,单击“插入”,然后在“图表”组中单击“折线”

  3. Click the first Line chart option

    单击第一个折线图选项

  4. To hide the Legend, click the Ribbon’s Layout tab, click Legend, and click None

    若要隐藏图例,请单击功能区的“布局”选项卡,单击“图例”,然后单击“无”。

《excel图表配合下拉菜单_从下拉列表中选择Excel图表日期》

使图表动态 (Make the chart dynamic)

  1. Select the chart, and click the line to select it

    选择图表,然后单击线以将其选中

  2. In the formula bar, change the series formula, replacing cell references with range names:

    在公式栏中,更改系列公式,将单元格引用替换为范围名称:

    =SERIES(Chart!$B$1,Chart!XValues,Chart!YValues,1)

    = SERIES(图表!$ B $ 1,图表!XValues,图表!YValues,1)

《excel图表配合下拉菜单_从下拉列表中选择Excel图表日期》

测试图表 (Test the chart)

  1. Select a start and end date from the drop down lists, and the chart will display that range

    从下拉列表中选择开始和结束日期,图表将显示该范围

Warning: If you select the entire range, the series formula will revert to absolute cell references instead of the named ranges. (This doesn’t happen in earlier versions of Excel.)

警告 :如果选择整个范围,则序列公式将恢复为绝对单元格引用,而不是命名范围。 (在早期版本的Excel中不会发生这种情况。)

下载样本文件 (Download the Sample File)

You can download the completed Excel 2007 sample file for Dynamic Date Range Charts.

您可以为动态日期范围图表下载完整的Excel 2007示例文件。

[Note: Please see the post, Problems With Dynamic Charts in Excel and download that sample file — the Excel Table may cause problems.] _________________

[ 注意 :请参阅帖子“ Excel中的动态图表问题”并下载该示例文件-Excel表可能会引起问题。] _________________

翻译自: https://contexturesblog.com/archives/2009/05/03/select-excel-chart-dates-from-a-drop-down-list/

excel图表配合下拉菜单


推荐阅读
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • MyBatis多表查询与动态SQL使用
    本文介绍了MyBatis多表查询与动态SQL的使用方法,包括一对一查询和一对多查询。同时还介绍了动态SQL的使用,包括if标签、trim标签、where标签、set标签和foreach标签的用法。文章还提供了相关的配置信息和示例代码。 ... [详细]
  • 十大经典排序算法动图演示+Python实现
    本文介绍了十大经典排序算法的原理、演示和Python实现。排序算法分为内部排序和外部排序,常见的内部排序算法有插入排序、希尔排序、选择排序、冒泡排序、归并排序、快速排序、堆排序、基数排序等。文章还解释了时间复杂度和稳定性的概念,并提供了相关的名词解释。 ... [详细]
  • 本文介绍了游标的使用方法,并以一个水果供应商数据库为例进行了说明。首先创建了一个名为fruits的表,包含了水果的id、供应商id、名称和价格等字段。然后使用游标查询了水果的名称和价格,并将结果输出。最后对游标进行了关闭操作。通过本文可以了解到游标在数据库操作中的应用。 ... [详细]
  • 本文详细介绍了Spring的JdbcTemplate的使用方法,包括执行存储过程、存储函数的call()方法,执行任何SQL语句的execute()方法,单个更新和批量更新的update()和batchUpdate()方法,以及单查和列表查询的query()和queryForXXX()方法。提供了经过测试的API供使用。 ... [详细]
  • 006_Redis的List数据类型
    1.List类型是一个链表结构的集合,主要功能有push,pop,获取元素等。List类型是一个双端链表的结构,我们可以通过相关操作进行集合的头部或者尾部添加删除元素,List的设 ... [详细]
  • IjustinheritedsomewebpageswhichusesMooTools.IneverusedMooTools.NowIneedtoaddsomef ... [详细]
  • 欢乐的票圈重构之旅——RecyclerView的头尾布局增加
    项目重构的Git地址:https:github.comrazerdpFriendCircletreemain-dev项目同步更新的文集:http:www.jianshu.comno ... [详细]
  • 合并列值-合并为一列问题需求:createtabletab(Aint,Bint,Cint)inserttabselect1,2,3unionallsel ... [详细]
  • Explain如何助力SQL语句的优化及其分析方法
    本文介绍了Explain如何助力SQL语句的优化以及分析方法。Explain是一个数据库SQL语句的模拟器,通过对SQL语句的模拟返回一个性能分析表,从而帮助工程师了解程序运行缓慢的原因。文章还介绍了Explain运行方法以及如何分析Explain表格中各个字段的含义。MySQL 5.5开始支持Explain功能,但仅限于select语句,而MySQL 5.7逐渐支持对update、delete和insert语句的模拟和分析。 ... [详细]
  • EPPlus绘制刻度线的方法及示例代码
    本文介绍了使用EPPlus绘制刻度线的方法,并提供了示例代码。通过ExcelPackage类和List对象,可以实现在Excel中绘制刻度线的功能。具体的方法和示例代码在文章中进行了详细的介绍和演示。 ... [详细]
  • ExcelApp#启动excel程序ExcelAppCreateOleObject(“Excel.Application”);#加载文件但不显示文件内容(true表 ... [详细]
  • php连接mysql显示数据,php连接mysql数据库的算法思想
    本文目录一览:1、怎么用php显示mysql数据表数据 ... [详细]
  • C#DataGridView控件中数据导出到Excel方法一:usingSystem;usingSystem.Collections.Generic;usingSys ... [详细]
  • 微软头条实习生分享深度学习自学指南
    本文介绍了一位微软头条实习生自学深度学习的经验分享,包括学习资源推荐、重要基础知识的学习要点等。作者强调了学好Python和数学基础的重要性,并提供了一些建议。 ... [详细]
author-avatar
道义信_686
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有