Excel数组仅复制包含字符串的单元格的公式 [英] Excel array Formula that copies only cells containing a string

查看:173
本文介绍了Excel数组仅复制包含字符串的单元格的公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更喜欢使用excel数组公式(但如果它只能在VBA中完成,那么就是这样),它从包含特定文本的列数组中复制所有单元格。下图显示了我所追求的以及我所尝试的内容。我已经接近了(感谢类似但不同的问题),但是无法完全达到我想要的地方。目前,我只获得了第一个细胞而不是所有细胞。在我的实际应用中,我正在搜索大约20,000个单元格,并将有几百个搜索项。我希望大多数搜索字词能够为我提供大约8到12个具有该值的单元格。

I would prefer to use an excel array formula (but if it can only be done in VBA, so be it) that copies ALL cells from a column array that contains specific text. The picture below shows what I am after and what I have tried. I'm getting close (thanks to similar, but different questions) but can't quite get to where I want. At the moment, I am getting only the first cell instead of all the cells. In my actual application, I am searching through about 20,000 cells and will have a few hundred search terms. I expect most search terms to give me about 8 - 12 cells with that value.

我正在使用的公式:

=INDEX($A$4:$A$10,MATCH(FALSE,ISERROR(SEARCH($C$1,$A$4:$A$10)),0))

Spredsheet Image

推荐答案

你需要得到ROWS。把它放在C4中并复制下来。

You need to get the ROWS. Put this in C4 and copy down.

= IFERROR(AGGREGATE(15,6,IF)(搜索($ C $ 1,$ A $ 4: $ A $ 10)> 0,ROW($ A $ 4:$ A $ 10)),ROW($ C4)-ROW($ A $ 4)+1),)

数组公式所以使用ctrl-shift-Enter

Array formula so use ctrl-shift-Enter

这篇关于Excel数组仅复制包含字符串的单元格的公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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