I have a school project and I need to filter students by a teacher. I have a random list where each student has a teacher assigned (G2:H100) and I need to create new sheets, one for each teacher, but my way is not working as I would like to. I have done this sheet for example, in just one tab (figure 1):
This is the formula at cell L2:
=QUERY(FILTER((G2:H100);INDEX((G2:H100);0;2)=H2);"Select Col1")
At the blue box, I have exactly what I wanted: Maria's student names listed on each row.
I don't know why I can't repeat the same results at green and brown boxes. I have the same formulas at both of them, just changing =H2 to =H3 and =H4, respectively.
The results: the names for each teacher at the same cell, not listed one row below the other, a blue box. I have tried other ways, but I could find a solution. I would like someone to help me figure out what is going on.