Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 在excel中,如何计算字符串中的数字之和?_Arrays_Excel_String - Fatal编程技术网

Arrays 在excel中,如何计算字符串中的数字之和?

Arrays 在excel中,如何计算字符串中的数字之和?,arrays,excel,string,Arrays,Excel,String,现在我有一个像“3,15,12,24,3,6,9,15”这样的字符串,我想知道这个字符串中所有数字的平均值,如何在excel或spss中实现 读字符串 用+替换, 评估 MsgBox评估(替换(“3,15,12,24,3,6,9,15”、“,”、“+”)) 或者简单地将字符串解析为数组并使用数组: Dim myArr as Variant myArr = Split("3,15,12,24,3,6,9,15", ",") 关于评论: 我有很多像“3,15,12……”这样的字符串,大多数都在

现在我有一个像“3,15,12,24,3,6,9,15”这样的字符串,我想知道这个字符串中所有数字的平均值,如何在excel或spss中实现

  • 读字符串
  • +
    替换
  • 评估
  • MsgBox评估(替换(“3,15,12,24,3,6,9,15”、“,”、“+”))


    或者简单地将字符串解析为数组并使用数组:

    Dim myArr as Variant
    myArr = Split("3,15,12,24,3,6,9,15", ",")
    

    关于评论: 我有很多像“3,15,12……”这样的字符串,大多数都在一列中,如何同时处理所有字符串? 最简单的解决方案可能是:

  • 选择单元格
  • 在功能区上>数据>文本到列
  • 选择逗号作为分隔符
  • 使用
    =SUM()
    =AVG()
    处理每个单元格的新值

    到目前为止,您尝试过什么?我尝试过使用VBA来解决这个问题,但我发现它太复杂了。现在我仍然不知道。我怀疑OP想要的是使用excel公式,而不是VBA:)@Zac-任何事情都是可能的。非常正确!这个组合可能就足够了,或者两者都够了,谢谢你的回答。但是我有很多像“3,15,12……”这样的字符串,大多数都在一列中,如何同时处理所有的字符串?