简体   繁体   English

从带有下拉菜单的表中选择数据

[英]select data from a table with a dropdown

I have a very big table where I add a column every month with new prices. 我有一张很大的桌子,每个月我都会在其中添加新价格列。 Then, I have to perform some analysis with those values. 然后,我必须使用这些值进行一些分析。 I have already made it but with the name of the column in the formula. 我已经做到了,但是在公式中使用了列名。 I want to know if I can point the formula to the drop-down so I just select the new period when it is available and get the results. 我想知道是否可以将公式指向下拉菜单,所以我只选择可用的新期间并获取结果。

Here are some examples of the formulas I have been using: 这是我一直在使用的一些公式示例:

{=SUM(IF($B17=Matriz[money];Matriz[31-10-2013]*Matriz[country];0))}

I would like to use something like 我想使用类似

{=SUM(IF($B17=Matriz[money];Matriz[*dropdow reference*]*Matriz[country];0))}

pd: the { } are for matrix calculations (when you use ctrl + shift + enter) pd: { }用于矩阵计算(使用ctrl + shift + enter时)

You are looking for the indirect function. 您正在寻找indirect功能。 With it, you can construct a string on the fly that contains your cell formula - then the indirect function will resolve the formula-string to its result. 有了它,您可以即时构造一个包含单元格公式的字符串-然后,间接函数会将公式字符串解析为其结果。

A bit difficult to describe without a concrete example. 没有具体的例子很难描述。

Have a look at the following resources: 看一下以下资源:

about.com about.com

http://www.cpearson.com/excel/indirect.htm http://www.cpearson.com/excel/indirect.htm

I suggest you to use INDEX + MATCH instead IDIRECT (since IDIRECT is volatile function and your formula would be recalculated each time any cell changed): 我建议您使用INDEX + MATCH代替IDIRECT (因为IDIRECT是易失函数,每次更改任何单元格都会重新计算您的公式):

=SUM(IF($B17=Matriz[money];INDEX(Matriz[#Data];0;MATCH(A1;Matriz[#Headers];0))*Matriz[country];0))

and press CTRL + SHIFT + ENTER to evaluate it. 然后按CTRL + SHIFT + ENTER进行评估。

alternatively you could use SUMPRODUCT - it doesn't require array entry: 或者,您可以使用SUMPRODUCT它不需要数组输入:

=SUMPRODUCT(($B17=Matriz[money])*INDEX(Matriz[#Data];0;MATCH(M2;Matriz[#Headers];0))*Matriz[country])

I assumed that your dropdown value is in A1 cell. 我假设您的下拉值位于A1单元格中。

  • this part MATCH(A1;Matriz[#Headers];0) finds value from A1 cell in headers of your table 这部分MATCH(A1;Matriz[#Headers];0)从表头中的A1单元中查找值
  • this part INDEX(Matriz[#Data];0;MATCH(A1;Matriz[#Headers];0)) gets corresponding column of data 这部分INDEX(Matriz[#Data];0;MATCH(A1;Matriz[#Headers];0))获得相应的数据列

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

相关问题 Excel数据验证从表中选择 - excel data validation select from table 从 excel 复制粘贴下拉数据到 angular 材料表(或导入 excel)并将其转换为下拉 - copy paste dropdown data from excel to angular material table (or import excel) and convert it to dropdown 如果下拉列表中的条件与表中的数据匹配,则粘贴行:如果包含下拉列表的单元格留空,则跳过部分代码 - Paste rows if criteria from dropdown lists match the data in the table: skip part of the code if a cell containing a dropdown list is left blank 如何从Excel数据透视表中选择数据? - How do I select data from the excel pivot table? 如何从另一个工作表中选择数据透视表数据范围 - How to select a pivot table data range from another sheet 根据下拉列表选择,使用其他表中的数据填充空表 - Populate empty table with data from other tables based on dropdown list selection 从Internet Explorer下拉列表中选择选项 - Select option from Internet Explorer dropdown list PowerPivot,数据模型,可从数据输入表中选择单独表中的日期列表 - PowerPivot, Data Model to select from a data entry table against a list of dates in a separate table 无法使用VBA从硒的下拉列表中进行选择 - Unable to select from dropdown in selenium using vba 尝试从下拉框中选择项目 - Trying to select item from dropdown box
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM