Excel按公式选择条件数据

时间:2015-07-28 15:14:51

标签: excel excel-formula

坚持看起来容易的任务。我有一张这样的桌子:
AAAA勺子
BBBB前叉
CCCC棒
BBBB挖掘机
AAAA苹果
BBBB钉​​子 AAAA上限
CCCC西瓜
CCCC香蕉
BBBB雪泥
AAAA馅饼
CCCC锡板
AAAA树莓

并且只需要选择" AAAA"值到另一个表: 勺子
苹果

馅饼
覆盆子
需要通过公式以dinamically方式进行,因此每次第一次表更新时都会更新。 VBA并不是那么困难,但需要公式。

1 个答案:

答案 0 :(得分:1)

I assumed that your entries where in two columns. For this equation I put them in B and C starting at row 2. I used F1 to enter the string you want to sort by.

=IFERROR(INDEX($C$2:$C$14, SMALL(IF($F$1=$B$2:$B$14, ROW($B$2:$B$14)-MIN(ROW($B$2:$B$14))+1, ""), ROW(C1))), "")

You have to paste this equation in as many rows as the number of answers you expect. If you expect 20 results paste this into 20 rows and the last ROW(C1) should auto increment. The IFERROR keeps the cell blank if no match is included.

Also after entering the equation you have to do Ctrl+Shift+Enter