Excel教程 怎样通过日期区域查询外部数据
发布时间:2015-06-06 来源:查字典编辑
摘要:可以在指定单元格输入一个起始日期,再输入一个结束日期,数据表会自动从指定的文件中搜索数据并返回到工作表中。比如在指定单元格中输入&ldquo...
可以在指定单元格输入一个起始日期,再输入一个结束日期,数据表会自动从指定的文件中搜索数据并返回到工作表中。
比如在指定单元格中输入“1996-1-1”日期,再在另外一个单元格输入“1997-5-1”,数据表将自动从指定的数据库或文件中把所有日期介于1996-1-1到1997-5-1之间的数据取到表中。
具体设置过程如下:
1.先来导入数据,单击菜单栏--数据--获取外部数据--自其它来源--来自Microsoft Query。

2.选择数据源,Excel Files*,确定。

3.数据库名称为销售数据.xlsx,文件类型xlsx格式,单击确定。

4.直接单击下一步,直到查询向导的最后一步,勾选在Microsoft Query中查看数据或编辑查询,确定。

5.下面,我们来对Microsoft Query进行设置,点击条件--添加,设置字段、运算符和指定值。

6.输入开始日期和结束日期,完成之后单击确定按钮。

7.设置完了,开始导入数据,选择显示方式以及数据的放置位置,单击属性按钮。

8.看到连接属性这个界面,我们其他不要管,直接点击参数。

9.参数名称看到起始日期和结束日期,从单元格中获取数值,勾选单元格值更改时自动刷新,确定。

10.我们最后来测试一下,输入起始日期,表格数据立即变化,都是指定区间内的数据。
