简体   繁体   中英

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.

Basically, the table looks like this (Table is in 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:

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:

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).

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).

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   

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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