从字符串中提取数字 - Google 电子表格 [英] Extract digits from string - Google spreadsheet

查看:24
本文介绍了从字符串中提取数字 - Google 电子表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Google 电子表格中,我需要一个公式来提取包含在任意字符串中的所有数字(0 到 9),该字符串可能包含任何可能的字符并将它们放入单个单元格中.

In Google spreadsheets, I need a formula to extract all digits (0 to 9) contained into an arbitrary string, that might contain any possible character and put them into a single cell.

示例(输入 -> 输出)

Examples (Input -> Output)

d32Ελληνικάfe9j.r/3-fF66 -> 329366
h01j2j3jFxF$$4j5j6j7j8j9 -> 0123456789

推荐答案

您可以使用 \D+ 正则表达式替换所有非数字字符,并使用

You may replace all non-digit characters using the \D+ regex and an empty string replacement with

=REGEXREPLACE(A11,"\D+", "")

或将其转换为数字:

=VALUE(REGEXREPLACE(A11,"\D+", ""))

这篇关于从字符串中提取数字 - Google 电子表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆