简体   繁体   English

Excel,要根据其值查找一个单元格,然后从先前找到的单元格位置开始查找另一个单元格

[英]Excel, To find a cell based on its value then find another cell starting the search from the previously found cell position

I have a huge excel sheet that i need to extract some data from... 我有一个巨大的Excel工作表,我需要从中提取一些数据...

To simplify what exactly i want to do i'll provide a simple example... 为了简化我到底想做什么,我将提供一个简单的示例...

Excel工作表范例

Now allow me to explain what is this and what i am looking to achieve... 现在让我解释一下这是什么以及我要实现的目标...

In the image the first table to the left contains the following: 在图像中,左侧第一个表格包含以下内容:

B1/B2/B3 which stands for Building 1, 2 and 3 Each building contains 3 floors, F1/F2/F3 Each floor have 3 different tasks that are in progress, T1/T2/T3 In front of each task there are two values V1/V2 which are planned progress and actual progress for the task respectively. B1 / B2 / B3分别代表1号楼,2号楼和3号楼。每个建筑物包含3层,F1 / F2 / F3每个层都有3个正在进行的不同任务,T1 / T2 / T3每个任务的前面都有两个值V1 / V2,分别是任务的计划进度和实际进度。

On the right table i want to extract all the values for Task 1 (T1) from the left table for all Buildings and all Floors... 在右表中,我想从左表中提取所有建筑物和所有楼层的任务1(T1)的所有值...

The first thought would be to do a manual extraction by linking each cell on right table with its corespondent on left table, but, with hundreds of buildings and 20th or 30th of floors and 10th of tasks this manual extraction seems like a month work... 首先想到的是通过将右表上的每个单元格与其左表上的核心单元链接来进行手动提取,但是,对于数百个建筑物,20层或30层以及第10项任务,这种手动提取似乎需要一个月的工作。 。

The other way is to do that automatically by finding each task and extracting its data to the new table, however there is a huge problem here... 另一种方法是通过找到每个任务并将其数据提取到新表中来自动执行此操作,但是这里存在很大的问题...

Each similar task is named the same so there are nine T1 and nine T2 and nine T3 in our example. 每个相似的任务都被命名为相同的任务,因此在我们的示例中有9个T1和9个T2和9个T3。 And same goes for the floors there are three of each... 地板也一样,每个地板有三个...

The only thing that is unique are the Buildings B1/B2/B3 唯一与众不同的是B1 / B2 / B3楼

So my question is, (explaining what i had in mind): 所以我的问题是,(解释我的想法):

Is there a way to run a search for lets say in our example B2 (which is Building 2) and once it is found it starts another search from this position (A14) and down looking for 'the first only occurrence' of F2 (which is Floor 2) (so it does not find F2 for Building 3 as well) and once it is found it starts a new search from This B2/F2 position (A19) and down looking for 'the first only occurrence' of T1 (which is Task 1) and then when it is found it extract the numbers in front of it (lets say the one under the second value V2) and place it in the right table which is the Task 1 table (T1) under V2 for B2 in front of F2. 有没有一种方法可以让我们在示例B2(位于2号楼)中进行搜索,一旦找到,它就会从该位置(A14)开始另一个搜索,然后向下寻找F2的“第一次出现”位于2楼)(因此它也没有找到3号楼的F2),一旦找到它,便从此B2 / F2位置(A19)开始新搜索,然后向下查找T1的“首次出现”是任务1),然后找到它,提取它前面的数字(说一个在第二个值V2下的数字),并将其放在右边的表中,该表是B2中V2下的任务1表(T1)。 F2的前面。

How to achieve that?, what would be the formula or whatever that should be in M5 in our example to get this job done? 如何实现这一目标?在我们的示例中,公式是什么,或者在M5中应该是什么才能完成这项工作? if it is even possible by a way or another! 如果甚至可以通过其他方式实现!

Thanks for your help in advance, Best Regards. 最好的问候,谢谢您的帮助。

The formula for M5 would be (entered as an array formula using ctrl + shift + enter ): M5的公式将是(使用ctrl + shift + enter输入为数组公式):

=INDEX($B:$C,MATCH($I$1,IF(ROW($A:$A)>MATCH($I5,IF(ROW($A:$A)>MATCH(IF(M$2="",L$2,M$2),$A:$A,0),$A:$A),0),$A:$A),0),MATCH(M$3,$B$1:$C$1,0))

This can be copied to fill in the rest of the table. 可以将其复制以填写表格的其余部分。

EDIT You can make it faster by limiting it to specific ranges instead of whole columns: 编辑您可以通过将其限制在特定范围而不是整个列中来使其更快:

=INDEX($B$1:$C$39,MATCH($I$1,IF(ROW($A$1:$A$39)>MATCH($I5,IF(ROW($A$1:$A$39)>MATCH(IF(M$2="",L$2,M$2),$A$1:$A$39,0),$A$1:$A$39),0),$A$1:$A$39),0),MATCH(M$3,$B$1:$C$1,0))

EDIT2: A quick explanation on the nested MATCH formulas: Start with the third MATCH , MATCH(IF(M$2="",L$2,M$2),$A:$A,0) . EDIT2:关于嵌套MATCH公式的快速解释:从第三个MATCHMATCH(IF(M$2="",L$2,M$2),$A:$A,0) This finds the row in column A that contains "B2" (14), so the formula becomes. 这将在A列中找到包含“ B2”(14)的行,因此公式变为。

=INDEX($B:$C,MATCH($I$1,IF(ROW($A:$A)>MATCH($I5,IF(ROW($A:$A)>14,$A:$A),0),$A:$A),0),MATCH(M$3,$B$1:$C$1,0))

The "14" is used in the comparison for the second IF , which will return all the values in column A as an array except the first 14 rows, which will be FALSE in the array. 在比较第二个IF使用“ 14”,它将把A列中的所有值作为一个数组返回,但前14行除外(在数组中为FALSE The second MATCH can then find the first instance of "F2" in that array (19). 然后,第二个MATCH可以在该数组中找到“ F2”的第一个实例(19)。 The formula is now: 现在的公式是:

=INDEX($B:$C,MATCH($I$1,IF(ROW($A:$A)>19,$A:$A),0),MATCH(M$3,$B$1:$C$1,0))

Repeat the same process as before to get the row of the first instance of "T1" after row 19. This is the row fed to INDEX . 重复与之前相同的过程,以在第19行之后获取“ T1”的第一个实例的行。这是馈入INDEX的行。 The last MATCH gives the column for INDEX . 最后一个MATCH给出INDEX的列。

暂无
暂无

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

相关问题 Java POI:如何查找具有字符串值的Excel单元格并获取其位置(行)以使用该位置查找另一个单元格 - Java POI: How to find an Excel cell with a string value and get its position (row) to use that position to find another cell 搜索列中的每个单元格以查找特定值,并从该值所在的行中的另一个单元格复制值 - Search each cell in a column to find a certain value and copy value from another cell in the row the value is found in 从Excel中的另一个单元格中找到一个单元格的单元格引用 - find cell reference of a cell from another cell in excel 查找单元格并在Excel中更改其值 - Find a cell and change its value in Excel Excel函数:如何根据另一个单元格值查找总数 - Excel function: How to find a total of a number based on another cell value excel 找到值并替换另一个单元格的值 - excel find the value and replace the value of another cell EXCEL:如何在列中查找一个单元格值并在另一个单元格中复制找到的值 - EXCEL: How to find a cell value in column and copy the found value in another cell 搜索单元格值,然后使用它在单元格数组中查找另一个值 - Search for cell value then use it to find another value in cell array 根据另一个单元格中的值搜索并查找值 - Seach and find value based on value in another cell Excel从搜索值在单元格内的范围中查找单元格 - Excel find cells from range where search value is within the cell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM