I am trying to automatically have Excel search a column for matching text and then compile all of the matches together. For example:

A B
Blue cat
Red dog
Yellow horse
Blue goat
Green dog
Blue dog

In a single cell, I want it to search column A for a term and return the corresponding text in B. For example, if I were searching column A for "Blue", it would return "cat, goat, dog".

My thought was some sort of IF statement (=IF(A1:A6 = "Blue",....), but haven't got a clue as to how to get what I want.

Thanks!