[英]Google Sheets - Formula to Concatenate Text in Range of Cells based on Numeric Value in Corresponding Range of Cells
I have this setup in Google Sheets:我在 Google 表格中有这个设置:
Row 1 is a list of ingredients.第 1 行是成分列表。 Rows 2-6 are specific plans that contain combinations of ingredients AF - if there is a 1 in the column, it contains the ingredient in the column.
第 2-6 行是包含成分 AF 组合的特定计划 - 如果列中有 1,则它包含列中的成分。
In column H, I want to concatenate the letters in row 1 if there is a 1 underneath it.在 H 列中,如果下面有一个 1,我想连接第 1 行中的字母。 So the formula I'm looking for in Col H should spit out the following:
所以我在 Col H 中寻找的公式应该吐出以下内容:
I've tried the TEXTJOIN formula you see in the formula bar but it's not working.我已经尝试了您在公式栏中看到的 TEXTJOIN 公式,但它不起作用。 Can anyone help with this?
有人能帮忙吗?
Thanks!谢谢!
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,"")))
Anthony,安东尼,
If I got it correctly what you want to combine, another option to do that is to use CONCATENATE + IF .如果我正确理解了您想要组合的内容,另一种选择是使用CONCATENATE + IF 。
I needed to combine 5 columns but make a note while a cell contains particular data (eg, when X is in the cell, not to combine columns but write a comment).我需要合并 5 列,但在单元格包含特定数据时做笔记(例如,当 X 在单元格中时,不是合并列而是写注释)。 And the combination of CONCATENATE + IF worked.
并且 CONCATENATE + IF 的组合有效。
I found this solution here .我在这里找到了这个解决方案。
Hope it'll be somehow helpful :)希望它会有所帮助:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.