Distinct elements in sheets

i am making an app to display students in a class based on their subject choice and using drona sheets as my database. i want that my list should only be populated with distinct subject names, so that i can click on the subject name and see the list of students taking that subject but i am unable to do so. i tried “sorting and filtering” but i was unable to form the correct query.
please help me out.

Try UNIQUE() in your formula.


It is used to get Unique values based on the given Column Index. In the case of Duplicate Column values for the given index, the first value will be returned, and rest all duplicates will be filtered out. ColumnIndexNumber starts at 1.


UNIQUEOBJECTS([column1, column2, column3, …], ColumnIndexNumber)