在Google表格或Excel中拆分:根据条件

问题描述 投票:0回答:1

我有这个Google电子表格。

-“产品名称”列的格式已经正确。全字,以“ +”分隔。

-第二列表示产品名称中包含字符串或Sugar的一部分。

-第三列是一些格式正确的产品(全名和“ +”)

  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   

我想以这种格式返回。成分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

所以基本上,我想从“重新格式化的产品”中拆分“ Sugar_word_in_product_name”列中的值为“ 1”

如果它是“ 0”,我想从“产品名称”中分成几列。

这项工作在一个条件下进行。 =IF(G2=0,SPLIT(F2,"+")).

这是我开始的查询,但不确定如何使它生效,并且没有值时返回空白单元格。

=IF(G2=0,SPLIT(F2,"+",IF(G2=1,SPLIT(H2,"+"))))

我有这个Google电子表格。 -“产品名称”列的格式已经正确。全字,以“ +”分隔。 -第二列的意思是在...

arrays if-statement google-sheets google-sheets-formula array-formulas
1个回答
0
投票

尝试:

© www.soinside.com 2019 - 2024. All rights reserved.