Google-sheets – List of unique values based on a criterion

google sheets

I am working on a Google Sheets that has a phrase, assigned number to the phrase and then I want to create a new list on a new column of phrases that have an assigned number less than 5. Moreover, I do not want phrases repeated:

Screenshot of my sheet

Currently I have this as my formula in cell E4:

=IFERROR(INDEX(C4:C25000,SMALL(IF(D4:D25000>5,IF(COUNTIF(C$4:C4,C4:C25000)=0,ROW(C4:C25000)-ROW(C$4)+1)),1)),"")

and it is not working.

Could anyone help me to get this right?

I have access to Excel so that would work too.

Best Answer

A similar question to this was posted on Stack Overflow.

Try this:

=UNIQUE(FILTER(A2:A, B2:B < 5))