Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default Sum of a number's digits

I need to insert check figures on my spreadsheet that equal the sum of a
number's digits. If cell A1 = 12,345.67, is there a formula that in cell A2
would add the digits 1+2+3+4+5+6+7 to equal 28?

Thanks for your help.
Claudia

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 751
Default Sum of a number's digits

Claudia,
the following *array* formula (needs to be committed with
Shift+Ctrl+Enter) will calculate what you ask:

=SUM(IF(ISNUMBER(VALUE(MID(A1,ROW(INDIRECT("1:"&LE N(A1))),1))),VALUE(MID(A1,ROW(INDIRECT("1:"&LEN(A1 ))),1))))

HTH
Kostis Vezerides

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 860
Default Sum of a number's digits

Hi Claudia,

I got this formula from these groups a while ago.
I can't remember who posted it but it has a Bob Phillips
look to it.

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

It will handle the sum of digits in A1 but it doesn't allow for the comma
separator and decimal point in your example. With a bit of data
manipulation you should be able to make it work.

HTH
Martin


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Sum of a number's digits

=SUMPRODUCT(--(MID(SUBSTITUTE(A1,".",""),ROW(INDIRECT("1:"&LEN(S UBSTITUTE(A1
,".","")))),1)))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Claudia" wrote in message
...
I need to insert check figures on my spreadsheet that equal the sum of a
number's digits. If cell A1 = 12,345.67, is there a formula that in cell

A2
would add the digits 1+2+3+4+5+6+7 to equal 28?

Thanks for your help.
Claudia



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 860
Default Sum of a number's digits

Yep!

Thought it was you Bob.
And it now has another bit of concise Phillips genius added to it.

Regards
Martin




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default Sum of a number's digits

It works great. Thank you!

"Bob Phillips" wrote:

=SUMPRODUCT(--(MID(SUBSTITUTE(A1,".",""),ROW(INDIRECT("1:"&LEN(S UBSTITUTE(A1
,".","")))),1)))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Claudia" wrote in message
...
I need to insert check figures on my spreadsheet that equal the sum of a
number's digits. If cell A1 = 12,345.67, is there a formula that in cell

A2
would add the digits 1+2+3+4+5+6+7 to equal 28?

Thanks for your help.
Claudia




  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 751
Default Sum of a number's digits

Bob,
can always count on you for a new idea...

Regards,
Kostis

Bob Phillips wrote:
=SUMPRODUCT(--(MID(SUBSTITUTE(A1,".",""),ROW(INDIRECT("1:"&LEN(S UBSTITUTE(A1
,".","")))),1)))

--
HTH

Bob Phillips


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Sum of a number's digits

Hi Kostis,

Didn't notice you in there.

Got the details, digesting it now thanks. Unfortunately time is marching on.

Regards

Bob

"vezerid" wrote in message
ups.com...
Bob,
can always count on you for a new idea...

Regards,
Kostis

Bob Phillips wrote:

=SUMPRODUCT(--(MID(SUBSTITUTE(A1,".",""),ROW(INDIRECT("1:"&LEN(S UBSTITUTE(A1
,".","")))),1)))

--
HTH

Bob Phillips




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
in excel, how to limit digits of negative hexadecimal numbers? [email protected] Excel Discussion (Misc queries) 1 February 1st 06 11:36 PM
counting digits, not numbers nebb Excel Worksheet Functions 4 January 24th 06 04:10 PM
Help! How do you get excel to find the x(changes daily, marked in a cell from another formula) highest numbers in a group of numbers and sum them up? C-Man23 Excel Worksheet Functions 3 January 19th 06 09:52 AM
Help! How do you get excel to find the x(changes daily, marked in a cell from another formula) highest numbers in a group of numbers and sum them up? C-Man23 Excel Worksheet Functions 1 January 9th 06 01:23 PM
Converting Numbers to Text properly Shirley Munro Excel Discussion (Misc queries) 1 February 16th 05 03:01 PM


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

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

About Us

"It's about Microsoft Excel"