Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
monkeyforce5
 
Posts: n/a
Default How do I find the sum of all digits in a number?

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.
  #2   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Fri, 9 Sep 2005 08:21:04 -0700, monkeyforce5
wrote:

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
  #3   Report Post  
CLR
 
Posts: n/a
Default

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

Vaya con Dios,
Chuck, CABGx3



"monkeyforce5" wrote:

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.

  #4   Report Post  
monkeyforce5
 
Posts: n/a
Default

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.

"Ron Rosenfeld" wrote:

On Fri, 9 Sep 2005 08:21:04 -0700, monkeyforce5
wrote:

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

  #5   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Fri, 9 Sep 2005 13:08:03 -0700, monkeyforce5
wrote:

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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with removing digits from a number frank Excel Discussion (Misc queries) 4 July 12th 05 02:31 AM
find smallest number not equal to 0 dave Excel Worksheet Functions 2 April 20th 05 10:56 PM
Find number of days between to dates Qaspec Excel Worksheet Functions 1 January 21st 05 12:14 AM
How do I find highest number in a row and change color? pamstolen Excel Worksheet Functions 3 January 18th 05 12:35 AM
How to format a number in Indian style in Excel? Victor_alb Excel Discussion (Misc queries) 2 December 21st 04 04:21 AM


All times are GMT +1. The time now is 02:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"