热门标签 | 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图表配合下拉菜单


推荐阅读
  • 本文将详细探讨Linux pinctrl子系统的各个关键数据结构,帮助读者深入了解其内部机制。通过分析这些数据结构及其相互关系,我们将进一步理解pinctrl子系统的工作原理和设计思路。 ... [详细]
  • 解读MySQL查询执行计划的详细指南
    本文旨在帮助开发者和数据库管理员深入了解如何解读MySQL查询执行计划。通过详细的解析,您将掌握优化查询性能的关键技巧,了解各种访问类型和额外信息的含义。 ... [详细]
  • 在维护公司项目时,发现按下手机的某个物理按键后会激活相应的服务,并在屏幕上模拟点击特定坐标点。本文详细介绍了如何使用ADB Shell Input命令来模拟各种输入事件,包括滑动、按键和点击等。 ... [详细]
  • MySQL索引详解与优化
    本文深入探讨了MySQL中的索引机制,包括索引的基本概念、优势与劣势、分类及其实现原理,并详细介绍了索引的使用场景和优化技巧。通过具体示例,帮助读者更好地理解和应用索引以提升数据库性能。 ... [详细]
  • 本文介绍如何使用Objective-C结合dispatch库进行并发编程,以提高素数计数任务的效率。通过对比纯C代码与引入并发机制后的代码,展示dispatch库的强大功能。 ... [详细]
  • 导航栏样式练习:项目实例解析
    本文详细介绍了如何创建一个具有动态效果的导航栏,包括HTML、CSS和JavaScript代码的实现,并附有详细的说明和效果图。 ... [详细]
  • 深入理解 SQL 视图、存储过程与事务
    本文详细介绍了SQL中的视图、存储过程和事务的概念及应用。视图为用户提供了一种灵活的数据查询方式,存储过程则封装了复杂的SQL逻辑,而事务确保了数据库操作的完整性和一致性。 ... [详细]
  • 构建基于BERT的中文NL2SQL模型:一个简明的基准
    本文探讨了将自然语言转换为SQL语句(NL2SQL)的任务,这是人工智能领域中一项非常实用的研究方向。文章介绍了笔者在公司举办的首届中文NL2SQL挑战赛中的实践,该比赛提供了金融和通用领域的表格数据,并标注了对应的自然语言与SQL语句对,旨在训练准确的NL2SQL模型。 ... [详细]
  • 本文详细介绍了Akka中的BackoffSupervisor机制,探讨其在处理持久化失败和Actor重启时的应用。通过具体示例,展示了如何配置和使用BackoffSupervisor以实现更细粒度的异常处理。 ... [详细]
  • DNN Community 和 Professional 版本的主要差异
    本文详细解析了 DotNetNuke (DNN) 的两种主要版本:Community 和 Professional。通过对比两者的功能和附加组件,帮助用户选择最适合其需求的版本。 ... [详细]
  • 本文介绍如何使用 NSTimer 实现倒计时功能,详细讲解了初始化方法、参数配置以及具体实现步骤。通过示例代码展示如何创建和管理定时器,确保在指定时间间隔内执行特定任务。 ... [详细]
  • 本文介绍如何通过创建替代插入触发器,使对视图的插入操作能够正确更新相关的基本表。涉及的表包括:飞机(Aircraft)、员工(Employee)和认证(Certification)。 ... [详细]
  • 本文由瀚高PG实验室撰写,详细介绍了如何在PostgreSQL中创建、管理和删除模式。文章涵盖了创建模式的基本命令、public模式的特性、权限设置以及通过角色对象简化操作的方法。 ... [详细]
  • 本文详细介绍了 MySQL 中 LAST_INSERT_ID() 函数的使用方法及其工作原理,包括如何获取最后一个插入记录的自增 ID、多行插入时的行为以及在不同客户端环境下的表现。 ... [详细]
  • 本文介绍如何使用 Python 的 xlrd 库读取 Excel 文件,并将其数据处理后存储到数据库中。通过实际案例,详细讲解了文件路径、合并单元格处理等常见问题。 ... [详细]
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社区 版权所有