sum 逗号分隔的整数字符串 [英] sum comma delimited string of integers
本文介绍了sum 逗号分隔的整数字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Google 表格中 - 我需要对一组数字求和,其中初始单元格包含分隔符和非数字:
In Google Sheets - I need to sum a set of numbers, where the initial cell contains delimiters and non numerics:
3; 6; 1; 3; None; 1; 1
我首先替换所有空格和非数字:
I first replace all spaces and non numerics:
=REGEXREPLACE(AG24,"\D+",",")
给出:3,6,1,3,1,1
Which gives: 3,6,1,3,1,1
由于 =SUM(3,6,1,3,1,1)
正确提供了 15,我想我会尝试将 REGEXREPLACE
结果传入 SUM()
并神奇地让它计算,但这样做会产生 0:
Since =SUM(3,6,1,3,1,1)
correctly provides 15, I figured I'd try passing in the REGEXREPLACE
result into SUM()
and magically have it compute, but doing so yields 0:
=SUM(REGEXREPLACE(AG24,"\D+",",")) = 0
我有点期待...
我也试过 SUMPRODUCT
,它也产生 0:
I've also tried SUMPRODUCT
, which also yields 0:
=SUMPRODUCT(ARRAYFORMULA(REGEXREPLACE(AG24,"\D+",","))) = 0
问题:那么如何对字符串整数列表求和?
Question: so how can I sum the list of string integers?
推荐答案
请尝试:
=sum(split(REGEXREPLACE(AG24,"\D+",","),","))
这篇关于sum 逗号分隔的整数字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文