excel匹配二维数组中的值(获取行) [英] excel match value(get row) in two-dimensional array

查看:651
本文介绍了excel匹配二维数组中的值(获取行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的excel工作表中具有以下结构。

I have the following structure in my excel sheet.

          E           F           G        H        
      ---------   ---------    ------    -------      
 2 |  blah        sometext     atext      smth
 3 |  textval     accc
 4 |  test        avfr
 5 |  check       
 6 |  ertyui      
 7 |  

您能建议使用 EXCEL函数的方法吗?(不是VBA )返回匹配字符串的行?

Can you suggest a way using EXCEL functions (not VBA) of getting back the row of a matching string?

例如:给定 test ,我需要取回 4 ,考虑到 ertyui 6

For example: given test I need to get back 4, given ertyui 6

我需要:


  • 要在此二维数组的所有列中进行查找,并且

  • the lookup to be done in all the columns of this two-dimensional array and

仅在一个单元格中具有该功能

have the function in one cell only

推荐答案

在A1中使用搜索字符串:

With your search string in A1:

=SUMPRODUCT((E2:H6=A1)*ROW(E2:H6))

很明显,如果出现个以上范围内的搜索字符串。但是,您提供的数据集中的每个值都是唯一的,因此我认为这不是问题。

Obviously this will fail if there is more than one occurrence of the search string within the range. However, each of the values in the dataset you provide is unique, so I presume that this is not an issue.

此外,如果一种可能,您需要弄清应优先选择的返回数可能是几个不同的行号中的哪个。

Besides, if that was a possibility, you would need to clarify which of potentially several different row numbers should be the preferred return.

问候

这篇关于excel匹配二维数组中的值(获取行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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