How to sum all digits in a number in Excel?
If you have a cell which contains a value, and now, you want to add all the digits together of the cell. For example, if you have the value 12345 in a cell, you want to do this calculation: 1+2+3+4+5, and get the value 15. Are there any good ways for you to sum all digits of a number in Excel?
Without adding the digits one by one manually, the following formulas can help you get the summation of a cell quickly.
1. Please enter or copy any one of the following formulas into a blank cell to output the result:
2. Then press Enter key to return the result, and select the cell C2, then drag the fill handle over to the range that you want to apply this formula, and you will get the summation of digits of each cell number.See screenshot:
- In the above formulas, A2 is the cell contains the number which you want to sum its digits.
- If there is negative sign or a decimal point in the number, the formulas return a #VALUE! error.
To add up all digits of a cell number, the following VBA code also can help you.
1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA code: Sum all digits of a cell number
Function SumDigits(Number As String) As Integer 'Updateby Extendoffice 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
3. Then save and close this code, return to the worksheet, and enter this formula =SumDigits(A2) into a blank cell, Then drag the fill handle down to the cells that you want to contain this formula, you will get the following result:
Here, I can also talk about a useful tool- Kutools for Excel, with its Sum numbers in a cell function, you can quickly add up all digits within a number.
After installing Kutools for Excel, please do as this:
1. Click a blank cell where you want to output the result.
2. Then click Kutools > Formula Helper > Formula Helper, see screenshot:
3. In the Formulas Helper dialog box, do the following operations:
- Select Math option from the Formula Type drop down list;
- Then choose Sum numbers in a cell from the Choose a fromula list box;
- In the right Arguments input section, select a cell that you want to sum digits.
4. Then click Ok button, and drag the fill handle over to the cells that you want to sum the digits in the cells. And all the digits in each cell have been added together, see screenshot:
More relative articles:
- Sum Diagonal Of A Range In Excel
- When you do some arithmetic calculations, you may need to sum numbers diagonally in a table. In fact, you can also sum diagonal numbers in Excel which doesn’t require you to sum the numbers one by one. If you want to know more about this question, please read the following article.
- Combine Duplicate Rows And Sum The Values
- In Excel，you may always meet this problem, when you have a range of data which contains some duplicate entries, and now you want to combine the duplicate data and sum the corresponding values in another column, as following screenshots shown. How could you solve this problem?
- Sum Based On Column And Row Criteria
- I have a range of data which contains row and column headers, now, I want to take a sum of the cells that meet both column and row header criteria. For example, to sum the cells which column criteria is Tom and the row criteria is Feb as following screenshot shown. This article, I will talk about some useful formulas to solve it.
- Sum Numbers From 1 To N In Excel
- For most of Excel users, sometimes, you need to delete first n characters from the beginning of the text strings or remove the last x characters from the end of the text strings as below screenshot shown. This article, I will introduce some handy tricks for solving this task quickly and easily in Excel.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 1 months agoHello Experts. I have a question. For instance i have 18487.73486. I want a cell to sum 18487 and another cell that would sum the 73486. How do I go about doing it? Will appreciate any response. tia
- To post as a guest, your comment is unpublished.· 2 months agoYour Solution or the Formula is excellent. Thanks for the quick fix .
- To post as a guest, your comment is unpublished.· 10 months agoI typed 3 zero in 2nd column and put sum formula i.e. 50 in 1st column and three zero in 2nd column but excel is not working because the zero are going to remove automatically. Could you please help me.
- To post as a guest, your comment is unpublished.· 10 months agoHello, Murtuza,
Sorry, I don't get your point, please give more detailed information about your problem, or you can insert a screenshot here.
- To post as a guest, your comment is unpublished.· 1 years agoHow 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.· 1 years agoHi,
Maybe the below article can solve your problem, please check it:
Hope it can help you!
- To post as a guest, your comment is unpublished.· 1 years agoThank you so much
- To post as a guest, your comment is unpublished.· 1 years agoI 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.· 1 years agoHello, john,
To calculate the average of multiple numbers within a cell, please apply the below formula:
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.· 1 years agoBefore 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 :
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.· 2 years agoHi,
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?
- To post as a guest, your comment is unpublished.· 2 years agoGreat 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.· 2 years agoIn same way how do i multiply
i have some excel numbers like Exm : 445, 556 , 713 . ( 4*4*5 ) i want multiplication of this
- To post as a guest, your comment is unpublished.· 2 years agoHi, Shriyan,
To multiply all numbers within a cell, you can apply the following user defined function:
Function MultiplyDigits(ByVal Number As Long) As Long
MultiplyDigits = 1
Do While Number >= 1
MultiplyDigits = MultiplyDigits * (Number Mod 10)
Number = Int(Number / 10)
And then apply this formula: =MultiplyDigits(A2)
Please try it, hope it can help you!
- To post as a guest, your comment is unpublished.· 2 years agooh thank you so much for u r reply Skyyang
- To post as a guest, your comment is unpublished.· 2 years agoThis 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.· 2 years agoHow 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.· 5 years agoVery useful your coding.
- To post as a guest, your comment is unpublished.· 5 years agoI'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.· 2 years agoif 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.· 2 years agoHi, 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
And then apply this formula: =SumDigits(A1).
Please try this.