How do I find the sum of all digits in a number?

G

Guest

How do I get Excel to return the sum of all digits in a number?
For example if i have the number 1234, i want excel to do the following
calculation:
1+2+3+4 and return the value 10. I need to know how to do this for any
number of any size.
 
R

Ron Rosenfeld

How do I get Excel to return the sum of all digits in a number?
For example if i have the number 1234, i want excel to do the following
calculation:
1+2+3+4 and return the value 10. I need to know how to do this for any
number of any size.

Here's one way, with your number in A1:

=SUMPRODUCT(1*MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))


--ron
 
G

Guest

I would use Data > TextToColumns > Fixed, to separate the digits into
individual columns and then just SUM those cells.......

Vaya con Dios,
Chuck, CABGx3
 
G

Guest

Thanks Ron that formula works perfectly. The reason i was doing this is
because i was looking at the sum of digits of all multiples of 9. It creates
a very interesting pattern.
 
R

Ron Rosenfeld

Thanks Ron that formula works perfectly. The reason i was doing this is
because i was looking at the sum of digits of all multiples of 9. It creates
a very interesting pattern.

Glad to help. Thank you for the feedback.


--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top