Search code examples
google-sheets-formula

How to Return Combination of Multiple Values From Other Cells Into the Same Cell In Google Sheets


I am trying to use Textjoin and IFS within a formula in Google Sheets to return a combination (all, none, or some) of values. I want to values to all be listed in the same cell at the end of a given row. In order for this to work, I am referencing a second tab within the same sheet.

I tried the following formula:

=ARRAYFORMULA(TEXTJOIN(" ",(IFS(Sheet2!F53="D",$F$5,Sheet2!R53="D",$R$5,Sheet2!T53="D",$T$5,""))))

What I want to happen is that if "D" is in the cell referenced on the 2nd sheet, it returns the specified text in the cell corresponding to $F$5, etc. If there are no cells with D in the referenced cell, then I just want it blank. When I used this formula, I get an error saying there is a wrong number of arguments for Textjoin.

I tried this formula:

=ARRAYFORMULA(TEXTJOIN(",", Sheet2!F23="D", $F$5, Sheet2!R23="D", $R$5, Sheet2!T23="D", $T$5, ""))

It simply listed each value in the cell corresponding to $F$5, etc and said true or false following the value. That is obviously not what I want either.


Solution

  • can you try:

    =TEXTJOIN(" ",1,{IF(Sheet2!F53="D",$F$5,),IF(Sheet2!R53="D",$R$5,),IF(Sheet2!T53="D",$T$5,)})