假设我在Excel中有以下数据表
Company Amount Text
Oracle $3,400 330 Richard ERP
Walmart $750 348 Mary ERP
Amazon $6,880 xxxx Loretta ERP
Rexel $865 0000 Mike ERP
Toyota $11,048 330 Richard ERP
我想浏览“文本”列中的每个项目,根据以下名称范围搜索项目:
Mary
Mike
Janine
Susan
Richard
Jerry
Loretta
并在“Person”列中返回名称(如果找到)。例如:
Company Amount Text Person
Oracle $3,400 330 Richard ERP Richard
Walmart $750 348 Mary ERP Mary
Amazon $6,880 xxxx Loretta ERP Loretta
Rexel $865 0000 Mike ERP Mike
Toyota $11,048 330 Richard ERP Richard
我在Excel中尝试了以下工作:
=IF(N2="","",
IF(ISNUMBER(SEARCH(Sheet2!$A$1,N2)),Sheet2!$A$1,
IF(ISNUMBER(SEARCH(Sheet2!$A$2,N2)),Sheet2!$A$2,
IF(ISNUMBER(SEARCH(Sheet2!$A$3,N2)),Sheet2!$A$3,
....
其中$ A $ 1:$ A $ 133是我的范围,N2是“文本”列值;但是,这是很多嵌套代码,显然Excel对可以拥有的嵌套IF语句的数量有限制。
是否有更简单的解决方案(数组?VBA?)
谢谢!