【问题标题】:How to split text using numbers as a delimiter in Google Sheets using a formula如何使用公式在 Google 表格中使用数字作为分隔符来拆分文本
【发布时间】:2020-06-06 08:40:04
【问题描述】:

我知道如何使用其他分隔符(例如逗号、等号等)来拆分文本。对于需要数字分隔符的示例,我遇到了麻烦。

使用逗号分隔符的典型拆分公式如下所示:

=SPLIT(A1, ",")

我正在努力拆分看起来像这样的文本。这里的分隔符是一个数字。

This is a random text of 20 characters but could be 30 characters as well.

输出应该是

This is a random text of | 20 | characters but could be | 30 | characters as well.

请帮忙。谢谢

【问题讨论】:

    标签: google-sheets split google-sheets-formula


    【解决方案1】:

    尝试以下方法:

    =SPLIT(REGEXREPLACE(A1,"\d+","|$0|"),"|")
    

    也许更好,删除空格:

    =SPLIT(REGEXREPLACE(A1,"\s*(\d+)\s*","|$1|"),"|")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-22
      • 2022-11-27
      • 1970-01-01
      • 2018-05-02
      • 1970-01-01
      • 2022-11-15
      • 1970-01-01
      相关资源
      最近更新 更多