Note: The other languages of the website are Google-translated. Back to English
Log in  \/ 
Register  \/ 


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:


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.

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

The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

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!
officetab bottom
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.