简体   繁体   English

Excel - 基于条件提取列表

[英]Excel - Extract a List Based on a Condition

I am having some trouble extracting a unique list from an Excel table based on a condition.我在根据条件从 Excel 表中提取唯一列表时遇到了一些问题。

Basically, the table looks like this (Table is in A1:B11):基本上,该表如下所示(表在 A1:B11 中):

Name     Count
Person1  10
Person2  2
Person3  3
Person4  1
Person5  1
Person6  18
Person7  1
Person8  5
Person9  7
Person10 2

I want to be able to extract the people out of this table that have Counts > 1 and have a new table that looks like this:我希望能够从这个表中提取计数 > 1 的人,并有一个看起来像这样的新表:

Name     Count
Person1  10
Person2  2
Person3  3
Person6  18
Person8  5
Person9  7
Person10 2

I have been trying to use index and match, but it has not been working out exactly the way I want.我一直在尝试使用索引和匹配,但它并没有完全按照我想要的方式工作。 Can someone help point me in the right direction?有人可以帮助我指出正确的方向吗?

Considering you have a Sheet1 table on A1:B11 like this:考虑到您在A1:B11上有一个Sheet1表,如下所示:

Name     Count
Person1  10
Person2  2
Person3  3
Person4  1
Person5  1
Person6  18
Person7  1
Person8  5
Person9  7
Person10 2

1) Select cell D1 (as an example) and type: =IFERROR(INDEX(Sheet1!$A:$B;SMALL(IF(Sheet1!$B:$B>1;ROW(Sheet1!$B:$B));ROW(1:1));1;1);"") now press CTRL + SHIFT + ENTER to apply the { ... } around the formula and drag D1 down for a few rows (it will show all the A Names that match your formula). 1) 选择单元格D1 (作为示例)并输入: =IFERROR(INDEX(Sheet1!$A:$B;SMALL(IF(Sheet1!$B:$B>1;ROW(Sheet1!$B:$B));ROW(1:1));1;1);"")现在按CTRL + SHIFT + ENTER在公式周围应用{ ... }并将D1向下拖动几行(它将显示所有A符合您的公式名称)。

2) Select cell E1 (as an example) and type: =IFERROR(INDEX(Sheet1!$A:$B;SMALL(IF(Sheet1!$B:$B>1;ROW(Sheet1!$B:$B));ROW(1:1));2;1);"") now press CTRL + SHIFT + ENTER to apply the { ... } around the formula again and drag E1 down for a few rows (it will show all the B Count that match your formula). 2) 选择单元格E1 (作为示例)并输入: =IFERROR(INDEX(Sheet1!$A:$B;SMALL(IF(Sheet1!$B:$B>1;ROW(Sheet1!$B:$B));ROW(1:1));2;1);"")现在按CTRL + SHIFT + ENTER再次在公式周围应用{ ... }并将E1向下拖动几行(它将显示所有与您的公式匹配的B计数)。

You'll get something like this as a result:你会得到这样的结果:

Name        Count   Name        Count
Person1     10      Person1     10
Person2     2       Person2     2
Person3     3       Person3     3
Person4     1       Person6     18
Person5     1       Person8     5
Person6     18      Person9     7
Person7     1       Person10    2
Person8     5           
Person9     7           
Person10    2   

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM