Search code examples
google-apps-scriptgoogle-sheetsgoogle-sheets-formula

Search Name in 2 cells and return the value in third cell if the name matches


I would like to create a formula in my Google Sheet where I put the name of any person in one cell then the data related to that person/'s should populate against that cell (in a single cell only)

I'm attaching an image for reference Request to share the possible solution for the above problem.

Thank you

I tried Vlookup but it is not showing up all the details and not working as well.

=TEXTJOIN(", ",TRUE,IF($E$2=$A$2:$A$12,$B$2:$B$12,""))

I tried the above Formula but it didn't work.


Solution

  • VLOOKUP just returns the first occurrence, altought you can use TEXTJOIN and FILTER to make that. Take a look at that:

    =TEXTJOIN(", ";TRUE;FILTER(B2:B12;E2=A2:A12))
    

    You can read more about that functions here: