=IF(A1<>"",TEXTJOIN(" ",TRUE,OFFSET(INDIRECT(ADDRESS(ROW(),2)),0,0,IFERROR(MATCH(A1,A2:A108,0),1+COUNTA(A2:A108)))),"")
If you are using Office 365, you can use this formula... The only part of this formula that requires Office 365 is TEXTJOIN. I noticed how you wanted spaces in between each thing, so TEXTJOIN is the best formula for this scenario. The part where it says "ROW(),2)" the 2 means column B.
Code:=IF(A1<>"",TEXTJOIN(" ",TRUE,OFFSET(INDIRECT(ADDRESS(ROW(),2)),0,0,IFERROR(MATCH(A1,A2:A108,0),1+COUNTA(A2:A108)))),"")
View attachment 21518