2

I have this setup in Google Sheets:

Google Sheet set up

Row 1 is a list of ingredients. Rows 2-6 are specific plans that contain combinations of ingredients A-F - if there is a 1 in the column, it contains the ingredient in the column.

In column H, I want to concatenate the letters in row 1 if there is a 1 underneath it. So the formula I'm looking for in Col H should spit out the following:

  1. Cell H2 --> A + B
  2. Cell H3 --> A + C
  3. Cell H4 --> A + B + D
  4. Cell H5 --> A + C + D
  5. Cell H6 --> A

I've tried the TEXTJOIN formula you see in the formula bar but it's not working. Can anyone help with this?

Thanks!

BigBen
  • 46,229
  • 7
  • 24
  • 40
Anthony
  • 61
  • 1
  • 5

2 Answers2

2

Nevermind, I just figured it out. I had to change my formula above to:

=textjoin(" + ", TRUE, arrayformula(IF($B7:$G7=1, $B$1:$G$1,"")))
TheMaster
  • 45,448
  • 6
  • 62
  • 85
Anthony
  • 61
  • 1
  • 5
0

Anthony,

If I got it correctly what you want to combine, another option to do that is to use CONCATENATE + IF.

I needed to combine 5 columns but make a note while a cell contains particular data (e.g., when X is in the cell, not to combine columns but write a comment). And the combination of CONCATENATE + IF worked.

I found this solution here.

Hope it'll be somehow helpful :)

inle
  • 11
  • 1