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


推荐阅读
  • 毕业设计:基于机器学习与深度学习的垃圾邮件(短信)分类算法实现
    本文详细介绍了如何使用机器学习和深度学习技术对垃圾邮件和短信进行分类。内容涵盖从数据集介绍、预处理、特征提取到模型训练与评估的完整流程,并提供了具体的代码示例和实验结果。 ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 本文详细介绍了Akka中的BackoffSupervisor机制,探讨其在处理持久化失败和Actor重启时的应用。通过具体示例,展示了如何配置和使用BackoffSupervisor以实现更细粒度的异常处理。 ... [详细]
  • MySQL索引详解与优化
    本文深入探讨了MySQL中的索引机制,包括索引的基本概念、优势与劣势、分类及其实现原理,并详细介绍了索引的使用场景和优化技巧。通过具体示例,帮助读者更好地理解和应用索引以提升数据库性能。 ... [详细]
  • 优化ListView性能
    本文深入探讨了如何通过多种技术手段优化ListView的性能,包括视图复用、ViewHolder模式、分批加载数据、图片优化及内存管理等。这些方法能够显著提升应用的响应速度和用户体验。 ... [详细]
  • 本文详细介绍了如何解决Uploadify插件在Internet Explorer(IE)9和10版本中遇到的点击失效及JQuery运行时错误问题。通过修改相关JavaScript代码,确保上传功能在不同浏览器环境中的一致性和稳定性。 ... [详细]
  • C++实现经典排序算法
    本文详细介绍了七种经典的排序算法及其性能分析。每种算法的平均、最坏和最好情况的时间复杂度、辅助空间需求以及稳定性都被列出,帮助读者全面了解这些排序方法的特点。 ... [详细]
  • 本文介绍了Java并发库中的阻塞队列(BlockingQueue)及其典型应用场景。通过具体实例,展示了如何利用LinkedBlockingQueue实现线程间高效、安全的数据传递,并结合线程池和原子类优化性能。 ... [详细]
  • 本文详细介绍了Java中org.w3c.dom.Text类的splitText()方法,通过多个代码示例展示了其实际应用。该方法用于将文本节点在指定位置拆分为两个节点,并保持在文档树中。 ... [详细]
  • 2023年京东Android面试真题解析与经验分享
    本文由一位拥有6年Android开发经验的工程师撰写,详细解析了京东面试中常见的技术问题。涵盖引用传递、Handler机制、ListView优化、多线程控制及ANR处理等核心知识点。 ... [详细]
  • 本文深入探讨了 Python 列表切片的基本概念和实际应用,通过具体示例展示了不同切片方式的使用方法及其背后的逻辑。 ... [详细]
  • 尽管使用TensorFlow和PyTorch等成熟框架可以显著降低实现递归神经网络(RNN)的门槛,但对于初学者来说,理解其底层原理至关重要。本文将引导您使用NumPy从头构建一个用于自然语言处理(NLP)的RNN模型。 ... [详细]
  • 基于KVM的SRIOV直通配置及性能测试
    SRIOV介绍、VF直通配置,以及包转发率性能测试小慢哥的原创文章,欢迎转载目录?1.SRIOV介绍?2.环境说明?3.开启SRIOV?4.生成VF?5.VF ... [详细]
  • 本文深入探讨了 Python 中的循环结构(包括 for 循环和 while 循环)、函数定义与调用,以及面向对象编程的基础概念。通过详细解释和代码示例,帮助读者更好地理解和应用这些核心编程元素。 ... [详细]
  • 本文提供了一系列Python编程基础练习题,涵盖了列表操作、循环结构、字符串处理和元组特性等内容。通过这些练习题,读者可以巩固对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社区 版权所有