将公式转换为 ArrayFormula

Turning formula into ArrayFormula

我有这个公式可以计算 Contents!$BJ4 中的匹配项。

=ARRAYFORMULA(IF(NOT(REGEXMATCH(J4, 
"\w")),0,SUM(COUNTIF(REGEXREPLACE(SPLIT(J4,","),"
[\s]",""),REGEXREPLACE(SPLIT(Contents!$B,","),"[\s]","")))))

公式在 K4 中,但理想情况下,我希望它可以直接向下 J 返回值到相关的相邻 K。我试过了,但没用。刚刚填充了公式所在的单元格

=ARRAYFORMULA(IF(NOT(REGEXMATCH(J4:J, 
"\w")),0,SUM(COUNTIF(REGEXREPLACE(SPLIT(J4:J,","),"
[\s]",""),REGEXREPLACE(SPLIT(Contents!$B,","),"[\s]","")))))

我知道我可以直接填写,但问题是用户插入行。

提前感谢您的帮助

=ARRAYFORMULA(IF(LEN(A2:A), IFERROR(VLOOKUP(A2:A, 
 QUERY(TRIM(TRANSPOSE(SPLIT(Contents!B1, ","))), 
 "select Col1,count(Col1) group by Col1", 0), 2, 0), 0), ))