[英]Split In Google Sheets or Excel : based on condition
I have this Google Spreadsheet.我有这个谷歌电子表格。
-The product name column is already in a good format. - 产品名称栏的格式已经很好了。 Full word and delimited by "+".
完整的单词并由“+”分隔。
-The second column is meaning there is part of the string or Sugar in the product name. -第二列表示产品名称中有部分字符串或Sugar。
-The third columns are some product reformated in the good format (full name and "+") -第三列是一些以良好格式重新格式化的产品(全名和“+”)
Product name Sugar_word_in_product_name Product reformated
Choco + sug,oil 1 Choco + Sugar + oil
Tablets + Sofa 0
Television + table 0
sugar,oil,ingred 1 Sugar + oil + ingredients
I want to return in this format.我想以这种格式返回。 Ingredients 1, Ingredients 2...
成分1,成分2...
Product name Sugar_word_in_product_name Product reformated Ingredients1 Ingredients2 Ingredients3
Choco + sug,oil 1 Choco + Sugar + oil Choco Sugar oil
Tablets + Sofa 0 Tablets Sofa
Television + table 0 Television Table
sugar,oil,ingred 1 Sugar + oil + ingredients Sugar Oil Ingredients
0
So basically, I want to split if it's "1" in column "Sugar_word_in_product_name" From "Product reformated"所以基本上,如果它在“Sugar_word_in_product_name”列中为“1”,我想从“产品重组”中拆分
If its "0" I want to split into columns from "product name".如果它的“0”我想从“产品名称”拆分成列。
This work on one condition.这项工作在一个条件下。
=IF(G2=0,SPLIT(F2,"+")).
That's the query I started but not sure how to make it work and returning blanks cells when no values.那是我开始的查询,但不确定如何使它工作并在没有值时返回空白单元格。
=IF(G2=0,SPLIT(F2,"+",IF(G2=1,SPLIT(H2,"+"))))
try:尝试:
=ARRAYFORMULA(IFERROR(IF(B2:B=1; SPLIT(C2:C; "+"); SPLIT(A2:A; "+"))))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.