简体   繁体   English

Excel索引+ if +间接

[英]Excel Index + if + indirect

I am helping a friend with a work task he's been given and can't figure out the last part. 我正在帮助一个朋友完成他的工作任务,无法弄清最后一部分。 We are given a matrix with a list of workers / users in the following layout: 我们为矩阵提供了以下布局的工作人员/用户列表:

Location  | First Name | Last Name | Property 1 | Property 2 | Property 3 | .. | Property N
Frankfurt | Adam       | Schmidt   | X          |            | X          | .. | X,

ie the properties are in boolean form (X to indicate 'Yes', or empty to indicate 'No'). 即,属性为布尔形式(X表示“是”,空为表示“否”)。

The task is to search all users based on Location + 1 property that we are able to select from the N properties, ie we have a drop-down menu somewhere with all properties 1,2,..,N where we can select exactly 1 of the properties. 任务是根据“位置+ 1”属性搜索所有用户,我们可以从N个属性中进行选择,即,我们在某个位置具有一个下拉菜单,其中所有属性1,2,..,N可以精确选择1属性。

The output should be the format: Location | 输出应采用以下格式:Location | First Name | 名| Last Name. 姓。

So, my idea was to replace the standard IF(("array for criteria 1"= "criteria 1") * ("array for criteria 2" = "yes"), ...) with the ADDRESS of the property we select, which we then transformed from text value into cell reference using the INDIRECT function. 因此,我的想法是将标准IF((“条件1的数组” =“条件1”)*(“条件2的数组” =“是”),...)替换为我们选择的属性的地址,然后使用INDIRECT函数将其从文本值转换为单元格引用。

To give an example, if we select property 1 (located in column D) in the drop-down menu, the ADDRESS function will return $D$1 as the starting field, and $D$100 as the ending field. 举个例子,如果我们在下拉菜单中选择属性1(位于D列),则ADDRESS函数将返回$ D $ 1作为开始字段,并返回$ D $ 100作为结束字段。 These fields are then used inside an INDIRECT function inside the main (long) search function. 这些字段然后在主(长)搜索功能内的INDIRECT功能内使用。

I've seen from other posts on the internet that it is possible to use SUM(INDIRECT(cell with starting cell defined&":"&cell with ending cell defined)), so I tried something similar in my function, but it doesn't seem to work. 我从互联网上的其他帖子中看到,可以使用SUM(INDIRECT(定义了起始单元格的单元格&“:”&定义了结束单元格的单元格)),因此我在函数中尝试了类似的操作,但是没有似乎有效。

Here is a picture of the formula & layout of the excel file. 这是excel文件的公式和布局的图片。 图片

You should organize your sheet into 3 sections: 您应该将工作表分为三个部分:

  1. Data set 资料集
  2. Criteria 标准
  3. Result Set 结果集

进阶筛选

Follow the steps to create the button action for Search. 请按照以下步骤为“搜索”创建按钮操作。

  1. Navigate to 'Developer' tab. 导航到“开发人员”标签。
  2. Click on Insert > Button. 单击插入>按钮。
  3. Draw a button. 画一个按钮。 The 'Assign Macro' dialog box will be displayed. 将显示“分配宏”对话框。
  4. Click on Record. 单击记录。
  5. Enter the macro name as 'SearchRecords' and click on OK. 输入宏名称为“ SearchRecords”,然后单击“确定”。
  6. Click on any empty cell. 单击任何空单元格。 Navigate to 'Data' tab. 导航到“数据”标签。
  7. In the 'Sort & Filter' section click on 'Advanced'. 在“排序和筛选”部分中,单击“高级”。
  8. Select 'Copy to another location' radio button and enter the range based on data set and criteria locations. 选择“复制到另一个位置”单选按钮,然后根据数据集和条件位置输入范围。

选择高级过滤器选项

  1. Click on OK. 单击确定。
  2. Navigate to 'Developer' tab and click on 'Stop Recording'. 导航到“开发人员”选项卡,然后单击“停止记录”。
  3. Rename the button to 'Search'. 将按钮重命名为“搜索”。

Now you can update the search criteria and click on the search button to update the results in the adjacent location. 现在,您可以更新搜索条件,然后单击搜索按钮以更新相邻位置中的结果。

A much easier way would be to organize your input data as follows: 一种更简单的方法是按以下方式组织输入数据: 透视数据

This data set is Pivot friendly. 该数据集是数据透视友好的。 You can then create a Pivot Table of the data set. 然后,您可以创建数据集的数据透视表。 Move the Location and Property fields to the Report Filter section, the Full Name to the Row Labels section and the Location to the Values section. 将位置和属性字段移到“报表过滤器”部分,将“全名”移到“行标签”部分,然后将“位置”移到“值”部分。

Please note Full Name is just a concatenated value of 'First Name' & 'Last Name'. 请注意,全名只是“名”和“姓”的串联值。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM