I have a sheet of over 5k records and many columns. I need a way to 'filter' through multiple columns and then get the unique values of a different column.

Picture it like:
You have data of 100 Test instances taken by kids in school. Subjects of Math and Science. 3 different tests for each subject. Student in Column A. Subject in Column B. Test # in Column C.
Column D shows me if they passed their tests on the first try. If they did not, Column E shows me if they passed their tests on the second attempt.

I need to filter by Column E and get the Unique Test #'s