#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John Michl
 
Posts: n/a
Default Combining Digits

I'm wondering if there is a function that will simplify adding each
individual digit in a number string. Here's an example:
Input 123 --- formula 1 + 2 + 3 --- result 6

I could parse the number using left, right and mid functions but I'm
wondering if there is any easier approach.

Thanks for the ideas.

- John

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Combining Digits

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

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"John Michl" wrote in message
oups.com...
I'm wondering if there is a function that will simplify adding each
individual digit in a number string. Here's an example:
Input 123 --- formula 1 + 2 + 3 --- result 6

I could parse the number using left, right and mid functions but I'm
wondering if there is any easier approach.

Thanks for the ideas.

- John



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John Michl
 
Posts: n/a
Default Combining Digits

Bob - this was exactly what I was looking for. I'm a big user of
SUMPRODUCT but never would have thought about using it this way. Still
not completely sure how it works but it does produce the correct
results.

Thanks!

- John

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Combining Digits

For your info John, it uses the length of the cell to pass to INDIRECT,
which is passed to ROIW, ROW(INDIRECT("1:"&LEN(A1)), which creates an array
of 1:n, where n is the length of A1. this is effectively used to extra each
digit of A1 (MID(A1,{1,2,...,n},1), in an array, which SP sums.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"John Michl" wrote in message
oups.com...
Bob - this was exactly what I was looking for. I'm a big user of
SUMPRODUCT but never would have thought about using it this way. Still
not completely sure how it works but it does produce the correct
results.

Thanks!

- John



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CLR
 
Posts: n/a
Default Combining Digits

One way would be to do Data TextToColumns Fixed, and split each digit out
into it's own column and then just summing horizontally......

Vaya con Dios,
Chuck, CABGx3



"John Michl" wrote:

I'm wondering if there is a function that will simplify adding each
individual digit in a number string. Here's an example:
Input 123 --- formula 1 + 2 + 3 --- result 6

I could parse the number using left, right and mid functions but I'm
wondering if there is any easier approach.

Thanks for the ideas.

- John




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
maximum number size/significant digits noel Excel Discussion (Misc queries) 4 February 20th 06 03:42 PM
Mistery digits on excel Bewilder Excel Discussion (Misc queries) 2 October 5th 05 06:28 PM
excel floating digits error Bewilder Excel Discussion (Misc queries) 3 October 5th 05 05:56 PM
Mod 10 & 11 Pablo Excel Worksheet Functions 13 August 10th 05 11:39 AM
Least number of digits in Y-axis labels Charley Kyd Charts and Charting in Excel 9 February 6th 05 03:03 PM


All times are GMT +1. The time now is 11:51 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"