You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Google Sheets中利用单个单元格内的CSV数据生成含所有变体的新数组/行集

Split Comma-Separated Parameters into Paired Rows (Google Sheets)

Got it, you’re so close with your existing attempts—let’s wrap this up. Here’s the exact formula that will generate the full set of name-parameter rows you need:

=ARRAYFORMULA(SPLIT(FLATTEN(A3:A & "|" & SPLIT(B3:B, ", ")), "|"))

Let’s break down why this works (and fix your earlier attempts):

  • Your first formula tried pairing A3:A with split parameters, but failed because SPLIT creates variable horizontal columns that don’t align cleanly with the single A3:A column.
  • Your FLATTEN attempt was on the right track, but you needed to first tie each name to its individual parameters before flattening everything into rows.

Here’s the step-by-step logic:

  1. SPLIT(B3:B, ", "): Splits each comma-separated parameter list into separate horizontal cells.
  2. A3:A & "|" & ...: Concatenates each name with its corresponding split parameter using a unique delimiter (we picked | here—just ensure it doesn’t appear in your actual data).
  3. FLATTEN(...): Turns all those concatenated name-parameter strings into a single vertical list, so each pair becomes a standalone row.
  4. SPLIT(..., "|"): Splits each concatenated string back into two columns (Name and Parameters), giving you the exact output you want.

Example Output (matching your desired result):

NameParameters
Co1Param1
Co2Param2
Co2Param3
Co3Param3
Co4Param2
Co4Param1

If you need to handle empty parameter cells to avoid blank rows, use this adjusted version:

=ARRAYFORMULA(IFERROR(SPLIT(FLATTEN(IF(B3:B<>"", A3:A & "|" & SPLIT(B3:B, ", "),)), "|")))

内容的提问来源于stack exchange,提问作者Prophet

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.27 16:42:40