But the formula can also be, F2 in the input
=OFFSET(E $ 1,SMALL(IF(ISERR(FIND(E $ 1,E $ 2:E $ 30878)),4 ^ 8,ROW($ 2:$ 30878)-1),ROW(A1)),) &""
Simultaneous presses of CTRL+SHIFT+Enter, enter the array formula, and drop down with the autofill handle.
The formula will be slow, if you want to make it faster, you can check F2:F2500 (whichever is the most that will show up), and in the edit field, type
=OFFSET(E$1,SMALL(IF(ISERR(FIND(E$1,E$2:E$30878)),4^8,ROW($2:$30878)- 1),ROW()-1),)&""
At the same time, press CTRL+SHIFT+Enter, enter the array of multi-cell formula, so you can let the formula is only executed once, to improve the speed of some of the operation.