The summation of digits

Jan Kalop

Active Member
Joined
Aug 3, 2012
Messages
389
Having in A11 digit 1909 and entering in B11 formula "=SUM(VALUE(MID(A11,ROW($I$1:OFFSET($I$1,LEN(A11)-1,0)),1)))" with enter and shift, display in B11 digit 19


then entering in,C11 formula "=SUM(VALUE(MID(B11,ROW($I$1:OFFSET($I$1,LEN(B11)-1,0)),1)))" with enter and shift, display in C11 digit 10


then entering in,D11 formula "=SUM(VALUE(MID(C11,ROW($I$1:OFFSET($I$1,LEN(C11)-1,0)),1)))" with enter and shift, display in D11 digit 1


How can I get the end result form cell D11 in cell B11 with one compact formula calculating all those 3 calculations in one attempt.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
The sum of digits iteratively applied is called the digital root.

[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
11​
[/td][td]
1909​
[/td][td="bgcolor:#CCFFCC"]
1​
[/td][td="bgcolor:#CCFFCC"]B11: =IF(A11 = 0, 0, A11 - FLOOR(A11-1, 9))[/td][/tr]
[/table]


This is simpler, but a bug in the MOD function appears for large numbers:

=IF(A11 = 0, 0, MOD(A11-1, 9) + 1)

See http://excel.tips.net/T003302_Large_Numbers_in_the_MOD_Function.html)
 
Last edited:
Upvote 0
Hello,

You can test following Array Formula:

Code:
=SUM(VALUE(MID(A11,ROW(INDIRECT("1:"&LEN(A11))),1)))

HTH
 
Upvote 0
Summing digits of a number, non array

=SUMPRODUCT(--MID(A1,ROW(INDIRECT("1:" & LEN(A1))),1))
 
Last edited:
Upvote 0
Great, thanks a lot to all suggestions, but it seams that the first one suits me the best. Fantastic, thank you.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top