Excel:检查列中是否存在单元格值,并返回同一行但不同列中的值 [英] Excel: Check if Cell value exists in Column, and return a value in the same row but different column

查看:401
本文介绍了Excel:检查列中是否存在单元格值,并返回同一行但不同列中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在检查列中是否存在值之后,我想将同一行中的单元格的值返回到另一列。



具体来说,我是检查列O中的任何值是否与列A中的值相匹配。如果我想从列A中与匹配项相同的行中的单元格获取相应的值,但这些值位于列f中。然后我想从列f中取这些值,并将它们放在与列O的值相同的行中。



这是我尝试过的公式: p>

  = IF(ISNA(MATCH(O2,$ A $ 2:$ A $ 1589,0)),no match,VLOOKUP O2,$ A $ 1:$ z $ 14000,16,FALSE))

这返回一个不匹配对于列P中的所有单元格。我尝试在VLOOKUP函数中调用col_index_num,但最好的办法是将其返回零,这不是正确的值。

解决方案

我认为以下公式应该给你你想要的东西。如果我正确理解您的问题,则希望返回与匹配在同一行的列F中的值:因此,对于列F使用的范围与列A的范围的长度相同。

  = IFERROR(INDEX($ F $ 2:$ F $ 1589,MATCH(O2,$ A $ 2:$ A $ 1589,0))1) ,no match)

向外工作,这是发生了什么。 b
$ b


  • 匹配功能在列A中查找O2中的值的完全匹配。



    如果找到匹配项,则返回匹配值在A列查找范围内的相对位置。



    如果找不到匹配项,则返回错误值。


  • 索引函数返回 i 行和 j 列中的值索引范围,在这种情况下是匹配中找到的行,以及索引范围中的第一列(和唯一)列F。


  • 最后,这两个函数包裹在一个IFERROR f中unction,以捕获将不会产生的错误值,如果没有匹配,并返回而不是字符串no match。




该公式将输入到单元格P2中,并通过列O中的最后一行数据进行复制。


After checking if a value exists in a column, I want to return the value of the cell in the same row to a different column.

Specifically, I am checking to see if any values in column O match with values from column A. If they do I want to take the corresponding value from cells in the same row as the matched items in column A, but these values are in column f. I then want to take those values from column f and put them in the same rows as the values from column O.

This is the formula I've tried:

=IF(ISNA(MATCH(O2,$A$2:$A$1589,0)),"no match", VLOOKUP(O2,$A$1:$z$14000,16,FALSE))

This returns a "no match" for all the cells in the column P. I tried messing around with the col_index_num in the VLOOKUP function, but the best I can do is get it to return zeros, which aren't the right values anyway.

解决方案

I think the following formula should give you what you are trying to get. If I understand your question correctly, you want to return the value in column F that is in the same row as the match: hence, the range I use for column F is the same length as the range for column A.

  =IFERROR(INDEX($F$2:$F$1589,MATCH(O2,$A$2:$A$1589,0),1),"no match")

Working outward, here is what is going on.

  • The match function is looking in column A for an exact match of the value in O2.

    If it finds a match, it returns the relative position of the matching value in the column A lookup range.

    If it finds no match, it returns an error value.

  • The index function returns the value in the i th row and j th column of the index range, in this case the row that was found in the match, and the first (and only) column in the index range, column F.

  • Finally, those two functions are wrapped in an IFERROR function, to catch the error value that will be generated if there is no match, and return instead the string "no match".

This formula would be entered in cell P2 and copied down through the last row of data in column O.

这篇关于Excel:检查列中是否存在单元格值,并返回同一行但不同列中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆