Excel – 匹配来自选项列表的子string – INDEX,MATCH和FIND一起使用
我想在video标题列表中search特定的电影标题,searchMATCH,并使用索引返回其描述。 我知道这可以通过列A中的filter中的文本search来完成,但我想用公式来完成。
**编辑:我认为这个问题的第一个版本,看起来像我只有一些电影和标题。 这些数据可能有助于:
Column A: 2,000 Total Video Titles (movie titles can appear more than once) Column E: 50 Movie Titles Column F: 50 Movie Descriptions
例:
AB Title Description Spiderman Review and BTS Best Dark Knight clips Bloopers: Liar Liar Interviews with The Departed cast
.1996多个video标题
在另外两栏中,我有标题和说明:
EF Title Description Dark Knight Dark Knight Description Spiderman Spider Man Description The Departed The Departed Liar Liar Liar Liar Description
… 46更多的电影标题和描述
编辑:添加更多的video标题:
Row A (video titles) B (description) 48 Titanic romantic scenes 49 Dumb and Dumber bloopers 50 BTS Schindler's List 51 Story behind Get Out movie 52 Who are the X-Men?
在B2内,我可以打字
=if(isnumber(find("Spiderman",A2)),index(F2:F4,match("Spiderman",E2:E4,0)))
然后,我可以为每部电影重复这个公式,但是到目前为止,完整的清单是超过50部电影。 我想创build这样的东西:
{Index($F$2:$F$4,match(TRUE,isnumber(find($E$2:$E$4,A2)),0))}
这样,我将searchA2来查看FIND是否从列表中返回ANY匹配,然后使用INDEX返回描述。 但是这个公式不起作用。 我哪里做错了?
两个想法,
1)在column B
有一个帮助列,并在column C
获得描述。
公式column B
,
=MATCH("*"&E2&"*",A:A,0)
公式column C
,
=INDEX(E:F,MATCH(ROW(),B:B,0),2)
2)反过来用一个简单的index
match
公式,
公式column G
(原标题),
=INDEX(A:A,MATCH("*"&E2&"*",A:A,0),1)
在我看来,这不能单靠公式来解决。
使用VBA可能会。
首先,添加一个新的模块。
其次,添加下面的function:
Function GetRow(xCell As Range, xRange As Range) i = 2 Do If Cells(i, xRange.Column).Value = "" Then Exit Do ElseIf InStr(1, Cells(xCell.Row, xCell.Column).Value, Cells(i, xRange.Column).Value) > 0 Then GetRow = Cells(i, xRange.Column + 1).Value End If i = i + 1 Loop End Function
第三,在列B中的所有行中添加公式:
=GetRow($A7; E:E)
- 如何自动化电子表格
- 将setCellStyle多次应用于org.apache.poi.ss.usermodel.Cell有什么作用?
- Ruby on Rails中的send_data与Spreadsheet插件的困难
- 根据表1中的非零值复制Sheet 1中某些行的特定单元格到Sheet 2的最后一个空行
- MS Excel回报周期公式显示年份/比较累计汇总在分开的行
- 如何在Excel中只复制特定颜色的文本?
- 如果在“工作表”,“本工作簿”和“模块”中运行VBA代码,它们会有什么不同?
- 目前使用INDEX,ROW,SUMPRODUCT和IFERROR来简化Excel公式
- 用python中的for循环添加新的excel表