提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何在Excel中总结数字中的所有数字?

如果您有一个包含值的单元格,现在您想要将单元格的所有数字相加。 例如,如果在单元格中具有值12345,则需要执行以下计算:1 + 2 + 3 + 4 + 5,并获取值15。 有没有什么好方法可以在Excel中总结一个数字的所有数字?

用公式计算数字中的所有数字

使用用户定义的函数将数字中的所有数字相加

使用Kutools for Excel汇总数字中的所有数字


将单元格中的所有单个数字求和:

您订购的 Kutools for Excel总和数字 在一个小区里 公式,您可以快速将一个数字的所有数字在一个单元格中相加。

DOC-总和位数,9

Kutools for Excel:比200方便的Excel加载项,可以在60天免费试用。 下载并免费试用现在!



无需手动逐个添加数字,以下公式可以帮助您快速获取单元格的总和。

1。 请输入此公式 =SUMPRODUCT(1*MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1))(A2 包含您想要总和其数字的数字,您可以将其更改为您的需要)放到数据旁边的空白单元格中,在本例中,我将在单元格B2中输入它。 看截图:

DOC-总和位数,1

2。 然后按 输入 键返回结果,然后选择单元格B2,然后将填充手柄拖到要应用此公式的范围,然后您将获得每个单元格数字的数字总和。

DOC-总和位数,1

笔记:

1。 除了上面的公式外,还可以使用数组公式: =SUM(1*MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)),并记得按下 Ctrl + Shift + Enter 键一起得到正确的结果。

2。 如果数字是一个正整数,这些公式可以正常工作。 如果数字中有负号或小数点,则公式会返回#VALUE! 错误。


要将单元号的所有数字相加,以下VBA代码也可以为您提供帮助。

1。 按住 ALT + F11 键,然后打开 Microsoft Visual Basic for Applications窗口.

2。 点击 插页 > 模块,并将以下代码粘贴到 模块窗口.

VBA代码:总计一个单元号的所有数字

 Function SumDigits(ByVal Number As Long) As Long
'Update 20140905
    Do While Number >= 1
        SumDigits = SumDigits + Number Mod 10
        Number = Int(Number / 10)
    Loop
End Function

3。 然后保存并关闭此代码,返回到工作表,然后输入此公式 = SumDigits(A2) 进入一个空白单元格,看截图:

DOC-总和位数,1

4。 然后将填充手柄向下拖到要包含此公式的单元格中,您将得到以下结果。

DOC-总和位数,1

笔记:

1。 如果您的号码的数字长于或等于11,您将得到一个错误值。

2。 如果数字包含负号,结果将为零; 如果该数字包含小数点,结果将是错误的。


在这里,我还可以谈谈一个有用的工具 - Kutools for Excel,其 总和数字在一个单元格中 功能,您可以快速添加数字中的所有数字。

Kutools for Excel : 与超过300方便的Excel加载项,在60天免费试用没有限制.

安装后 Kutools for Excel请按照以下步骤进行:

1。 单击要输出结果的空白单元格。

2。 然后点击 Kutools > 公式 > 总和数字在一个单元格中,看截图:

DOC-总和位数,1

3。 在 配方助手 对话框,单击 DOC-总和位数,1 按钮选择您想对数字进行求和的单元格值,请参阅截图:

DOC-总和位数,1

4。 然后点击 Ok 按钮,然后将填充柄拖到要对单元格中的数字进行求和的单元格中。 并且每个单元格中的所有数字都已添加在一起,请参阅截图:

DOC-总和位数,1

立即下载并免费试用Kutools for Excel!


Kutools for Excel:比200方便的Excel加载项,可以在60天免费试用。 下载并免费试用现在!


相关文章:

如何在Excel中添加一个范围的对角线?


Kutools for Excel - 最佳办公生产力工具提高80%的生产力

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能60天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    V SRIDHAR KUMAR · 19 days ago
    How to count number in a cell in excel i.e. for example : 1+1+2+3+4+5+6+7 = 8
  • To post as a guest, your comment is unpublished.
    Ezequiel · 1 months ago
    Thank you so much
  • To post as a guest, your comment is unpublished.
    john dick · 3 months ago
    I am trying to find the avg of multipule numbers in a cell, lets say 22,11,18,14,3,6 are all in the same cell is there a way for another cell to display 12.3?
    • To post as a guest, your comment is unpublished.
      skyyang · 3 months ago
      Hello, john,
      To calculate the average of multiple numbers within a cell, please apply the below formula:
      =IF(A1="","",ROUND(SUMPRODUCT(--(0&TRIM(MID(SUBSTITUTE(A1,",",REPT(" ",99)),ROW($1:$99)*99-98,99))))/(LEN(A1)-LEN(SUBSTITUTE(A1,",",))+1),2))
      Note: the last number 2 in the formula indicates that retain two decimal places after rounding. You can change it to your need.

      Please try it, hope it can help you!
  • To post as a guest, your comment is unpublished.
    yun · 9 months ago
    Before i ask i apologize about some rude and hard -to-understand expressions which could be in follow sentences caused by my poor English skill in advance.

    Thanks. It was helpful.
    I could use this functions and solve the problem though, I actually couldn't get how the function work.

    This is the function :
    =SUM(1*MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1))

    I know functions "SUM", "MID", "ROW", and "INDIRECT", but I have no idea about expressions "1*MID" and ""1:"&" at all.

    Can someone give me any answer or clue which can make me understand?
  • To post as a guest, your comment is unpublished.
    Birzhan · 1 years ago
    Hi,
    your formula is very useful.
    but I need to have a one number at the end, but your formula is giving two numbers.
    can you help?
    regards
  • To post as a guest, your comment is unpublished.
    panjianom · 1 years ago
    Great code!
    How to repeat the process into 1 digit with VBA code?
    Example: 463 > 4+6+3=13 > 1+3=4
  • To post as a guest, your comment is unpublished.
    Pranam Shriyan · 1 years ago
    In same way how do i multiply
    i have some excel numbers like Exm : 445, 556 , 713 . ( 4*4*5 ) i want multiplication of this
    thnx
    • To post as a guest, your comment is unpublished.
      skyyang · 1 years ago
      Hi, Shriyan,
      To multiply all numbers within a cell, you can apply the following user defined function:


      Function MultiplyDigits(ByVal Number As Long) As Long
      'Update 20140905
      MultiplyDigits = 1
      Do While Number >= 1
      MultiplyDigits = MultiplyDigits * (Number Mod 10)
      Number = Int(Number / 10)
      Loop
      End Function

      And then apply this formula: =MultiplyDigits(A2)

      Please try it, hope it can help you!
  • To post as a guest, your comment is unpublished.
    Tongle · 1 years ago
    This is not all possible permutations. If I put 123, how can I get the 27 permutations. That means, including 111 etc.
  • To post as a guest, your comment is unpublished.
    JOSH · 1 years ago
    How can I add the values in a cell. For example if i have a huge number like 4583789484858 in a cell and I want them added together in such a way that
    the system does 4+5+8+3+7+8+9+4+8+4+8+5+8 to give me result of 81?
  • To post as a guest, your comment is unpublished.
    Karthikeyan M K · 4 years ago
    Very useful your coding.

    thanks
  • To post as a guest, your comment is unpublished.
    jcraggie · 4 years ago
    I'm trying to figure out a formula using arrays to add/subtract a number from each digit in a cell. Example: If A1 contains 7721, then I'd like B1 to contain 2278 (subtracting 9 from each digit in A1). I have tried and tried to figure this out without success. Thank you!
    • To post as a guest, your comment is unpublished.
      Rehan · 1 years ago
      if i have decimal number for example 22.2456 in excel how can i Sum for All this Digits ?
      please help me
      • To post as a guest, your comment is unpublished.
        skyyang · 1 years ago
        Hi, Rehan,
        To sum all digits in decimal number, the following code may help you.

        Function SumDigits(Number As String) As Integer
        Dim x As Integer, C As String
        For x = 1 To Len(Number)
        C = Mid(Number, x, 1)
        If IsNumeric(C) Then SumDigits = SumDigits + C
        Next
        End Function

        And then apply this formula: =SumDigits(A1).

        Please try this.