首页 > 解决方案 > 从逗号分隔的 cel 中仅获取 X 个字符串

问题描述

很难找到一个简洁的解决方案来解决这个简单的问题。目前我有包含许多逗号分隔项目的单元格。我只想要前5个。

IE。单元格 A1 =

text, another string, something else, here's another one, guess what another string here, and another, hello i'm another string, another string etc, etc, etccccc

我试图抓住前 5 个字符串。

除此之外,我想知道我是否可以合并一个公式,例如=LEN(A1)>20

目前我做这个有很多;=IFERROR(INDEX( SPLIT(C31,","),1))然后=IFERROR(INDEX( SPLIT(C31,","),2))等然后运行上面的 LEN 公式。

有没有更简单的解决方案?非常感谢。

标签: regexgoogle-sheetsspreadsheet

解决方案


尝试,

 =split(replace(A1, find("|", SUBSTITUTE(A1, ", ", "|", 5)), len(A1), ""), ", ", false)

推荐阅读