I have the following set of lists of names in a Google Sheet:
╔═══╦════════════╦══════════╦══════════╗
║ ║ A ║ B ║ C ║
╠═══╬════════════╬══════════╬══════════╣
║ 1 ║ Barry ║ Rich ║ David ║
╠═══╬════════════╬══════════╬══════════╣
║ 2 ║ Rich ║ Jeff ║ Michael ║
╠═══╬════════════╬══════════╬══════════╣
║ 3 ║ Bruce ║ Bruce ║ Jeff ║
╠═══╬════════════╬══════════╬══════════╣
║ 4 ║ Rober ║ Barry ║ Joel ║
╠═══╬════════════╬══════════╬══════════╣
║ 5 ║ David ║ Joel ║ Howard ║
╠═══╬════════════╬══════════╬══════════╣
║ 6 ║ Michael ║ Howard ║ Rich ║
╚═══╩════════════╩══════════╩══════════╝
I'm trying to figure out a formula to use that searches for a name and returns all the names that appear in each column the name appears in. For example, if I search for Joel I want to get the entire contents of columns B and C.
You asked for a formula that
...searches for a name and returns all the names that appear in each column the name appears in
Please use the following formula
=query(ArrayFormula(regexextract(
query(flatten(TRANSPOSE(ArrayFormula(column(A2:C)&"-"&A2:C))),
"where Col1 matches '"&textjoin("|",1,(ArrayFormula(if(A2:C=A1,column(A2:C)&"-.*",""))))&"' ")
,"-(.*)")),
"where Col1 is not null ")