Excel公式查找值序列并返回行号

时间:2016-05-17 08:19:32

标签: excel-formula

我正在尝试查看一个列,我正在查找行中值的实例,然后检查下面单元格中的值是否与其他条件匹配。

输出是一个报告,我正在寻找机器名称上的匹配项和班次名称上的匹配项,然后在列表中的位置给我一个行号。我正在使用它作为我将在其上进行的各种查找的起点。我只需要在数据集中的三个班次中获得每台机器的起点。

我添加了一些我想要构建的源数据和输出表的图像。基本上我正在从输出矩阵的左边看到机器名称,并从矩阵的标题中移位,并尝试从源中获取行数,这些数据都在B列中。

查找范围为$B$2:$B$5000

第一个匹配的条件是单元格$I2内容,下面行的条件将匹配矩阵的第一个单元格的单元格$K1内容。

正如您所看到的那样,我在第一列中取得了成功,但却失败了。这是我使用的公式,在出现的第一个班次中得到机器的匹配但是因为公式是它没有真正测试两个标准。它在逻辑中找到传递并失败然后放弃。

= IF(INDEX('Kiwi Rep A'!$ B:$ B,MATCH($ I2,'Kiwi Rep A'!$ B:$ B,0)+1,0)= K $ 1,MATCH( $ I2,'Kiwi Rep A'!$ B:$ B,0),“Not Found”)

Source data View

Output Table

1 个答案:

答案 0 :(得分:0)

Where do you get the data from? It seems that you try to do some machine statistics from log files. How often do you need to run this?

You should consider to bring you data into a proper form first. RegEx might help here. For one-time actions this can probably be done best using an editor (like notpad++). For repeatable task there can be regex's be used in excel as well.

Anyhow with proper form I mean that you turn your report into a table by changing the CR/NL into tabs and load it into Excel as a table.But his might only be easy enough if the report has the same layout for each entry.

With the data as a table you can the use the Excel DB-functions

But depending on the data this might not be sufficient as well.