2

I have a list of people who belong to two groups (A or B). I want to create a column which lists all the people who belong to group A. I have been trying to come up with an array formula but I do not have a working example. Any help appreciated!

Names | Group | Desired Output

Bob | A | Bob

Fred | B | Eric

Matt | B | Dave

Eric | A | Fred

Dave | A |
Stew | B |
Fred | A |

Many Thanks in advance

3 Answers 3

1

Normal formula for column C:

C2=
=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW(B:B)/(B:B="A"),ROW()-1)), "")

Copy/paste down in column C for a sufficient number of cells.

Array formula: select a sufficient number of cells in column C and write the same formula in the formula bar then press Ctrl+Shift+Enter

Sign up to request clarification or add additional context in comments.

3 Comments

thanks, I tried this one, but I get a division by zero inside the row function. the true/false array loads, as does the row function but the division fails. any ideas?
hello, I got this one to work eventually by changing the offset. However I use this formula often and it is slowing down my whole sheet, and it takes a long time to evaluate when I try to step through it. Any ideas on how to make it more efficient. I have been trying to shrink the range by using a range reference instead of the entire column but I cant get it to work.
@Freelancer try like this: =IFERROR(INDEX($A$1:$A$100,AGGREGATE(15,6,ROW($B$1:$B$100)/($B$1:$B$100="A"),ROW()-1)), ""). Also try not putting it in a too large number of cells, just what is sufficient to get all the matches.
1

From this

+---+-------+-------+
|   |   A   |   B   |
+---+-------+-------+
| 1 | Name  | Group |
| 2 | Nick  | A     |
| 3 | Marc  | A     |
| 4 | Manny | B     |
| 5 | Luck  | A     |
+---+-------+-------+

you can create two pivot tables with Name in the row label and Group in the filter data. Then you can filter only people depending on the group.

+---+-------------------+---+
|   |         A         | B |
+---+-------------------+---+
| 1 | Group             | A |
| 2 |                   |   |
| 3 | Etichette di riga |   |
| 4 | Luck              |   |
| 5 | Marc              |   |
| 6 | Nick              |   |
+---+-------------------+---+

1 Comment

thanks but I need to reference it dynamically later on. I need cells to reference not a pivot table
0

So if your data is in range A1:B7 this would be the formula:

=IFERROR(INDEX($A$1:$A$7,SMALL(IF($B$1:$B$7="A",ROW($A$1:$A$7)-ROW($A$1)+1),ROWS($A$1:A1))),"")

This is array formula that is applied with Ctrl + Shift + Enter and you will need to drag it down.

2 Comments

thanks, when I try this, I only get the same value populated in the entire formula array, the first line. any ideas?
Can you confirm that you applied it with Ctrl + Shift + Enter. Because your issue is real only if you use just Enter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.