regex - 从逗号分隔的 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 公式。
有没有更简单的解决方案?非常感谢。
解决方案
尝试,
=split(replace(A1, find("|", SUBSTITUTE(A1, ", ", "|", 5)), len(A1), ""), ", ", false)
推荐阅读
- python - 你能解释一下下面的伪代码试图做什么吗?它可能是什么类型的代码?
- java - 如何从 livedata 中删除观察者,使其在导航回片段时不会显示两次
- docker - Docker 中的 KafkaStreamApi 工作,但不消耗记录
- encryption - 无法在 WSO2 Identity Server 5.9.0 (wso2is) 中加密密码
- twilio - Twilio Flex - 如何查看我的通话记录/记录?
- tomcat - actioncofig 找不到在 struts 中定义的路径 - 迁移后标记不再工作
- r - 打破while循环,在R中达到某个随机生成的值
- laravel - 在 Laravel eloquent 中显示来自过滤供应商的采购订单库列表
- linux - 从计算机 1 到计算机 2 扫描文件并返回结果?
- javascript - React Suspense 未加载后的组件?