Skip to main content

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?


Sum all digits of a number in a cell with formulas

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:

=SUMPRODUCT(1*MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1))
=SUM(INDEX(1*(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)),,))

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:

Notes:

  • 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.

Sum all digits of a number in a cell with User Defined Function

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:


Sum all digits of a number in a cell with easy feature

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.

Note:To apply this Sum numbers in a cell, firstly, you should download the Kutools for Excel, and then apply the feature quickly and easily.

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:

Download and free trial Kutools for Excel Now !


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.

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (26)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bonjour,
Je cherchais justement cette solution c.à.d. comment faire la somme des chiffres d'un nombre (de 4 chiffres) sur excel et je suis tombé sur ce site. Je suis en profonde admiration devant l'intelligence de certains qui ont trouvé des formules de ouf. Malheureusement, je ne suis pas à ce niveau pour les mettre en pratique. Je me suis dit (car j'aime me parler, comme ça, j'ai toujours raison LOL) que pourquoi chercher compliqué quand on peut faire plus simple et j'ai trouvé une solution qui n'est pas élégante (OK je ne suis pas Einstein) et qui marche. Que veut on de plus ! Je vous la donne ici.
Je prends un exemple avec un nombre à 4 chiffres mais vous pouvez ajouter autant de chiffres que vous voulez. Disons que ce nombre est dans la cellule A2 pour l'exemple :
=STXT($A$2;1;1)+STXT($A$2;2;1)+STXT($A$2;3;1)+STXT($A$2;4;1)
J'ai mis des $ pour pouvoir copier plus facilement et ensuite je n'ai qu'à changer le rang du chiffre, dans mon cas 1, 2, 3, 4 et vous pouvez allez aussi loin que vous voulez
En anglais, vous remplacez STXT par MID et en allemand par TEIL
Si vous voulez la somme du résultat (dans la cellule A3 par ex.), vous faites la même chose en remplaçant A2 par A3.
Voila
Julien
This comment was minimized by the moderator on the site
Já procurei mais não acho por nada eu queira fazer uma planilha que o resultado da soma final reduz o número a 1 dígito. Por exemplo o resultado deu 7+6=13 e ele virasse 1+3= 4
This comment was minimized by the moderator on the site
I want to two digits like: 11.03 and 1.11, so i want to answer is coming 13.02.kindly provide a formula.
This comment was minimized by the moderator on the site
I play KillerSudoku: If I have n number of sums (not the total or answer) but I have say 2 or 3 or more empty cells with number possibilities who's sum totals 15; say, the total is 15 and I have 4 empty squares that all live in the same cage (meaning non-repeating), how do I show all possible sums: ie, 2+3+6+4, or 3+5+1+6, or 3+4+6+1 and so on. Also, I need to sometimes show all possible sums with repeating. Can this be done in Excel
This comment was minimized by the moderator on the site
Hello, Kevin,Maybe the following article can do you a favor:https://www.extendoffice.com/documents/excel/3557-excel-find-all-combinations-that-equal-given-sum.html
Please try, thank you!
This comment was minimized by the moderator on the site
Hello 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
This comment was minimized by the moderator on the site
Your Solution or the Formula is excellent. Thanks for the quick fix .
This comment was minimized by the moderator on the site
I 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.
This comment was minimized by the moderator on the site
Hello, Murtuza,
Sorry, I don't get your point, please give more detailed information about your problem, or you can insert a screenshot here.
Thank you!
This comment was minimized by the moderator on the site
How to count number in a cell in excel i.e. for example : 1+1+2+3+4+5+6+7 = 8
This comment was minimized by the moderator on the site
Hi,
Maybe the below article can solve your problem, please check it:
https://www.extendoffice.com/documents/excel/1504-excel-count-letters-in-cell.html
Hope it can help you!
This comment was minimized by the moderator on the site
Thank you so much
This comment was minimized by the moderator on the site
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?
This comment was minimized by the moderator on the site
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!
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations