PC Review


Reply
Thread Tools Rate Thread

Combining Digits

 
 
John Michl
Guest
Posts: n/a
 
      20th Feb 2006
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 With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      20th Feb 2006
=SUMPRODUCT(--(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)))

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"John Michl" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 With Quote
 
=?Utf-8?B?Q0xS?=
Guest
Posts: n/a
 
      20th Feb 2006
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 With Quote
 
John Michl
Guest
Posts: n/a
 
      20th Feb 2006
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

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      21st Feb 2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA write macro change column with 3 number digits to 4 digits the James C Microsoft Excel Misc 3 25th Jan 2010 03:12 PM
How do you change single digits to recognized double digits? Evil with a K Microsoft Excel Worksheet Functions 6 18th May 2009 09:19 PM
How do you change single digits to recognized double digits? Evil with a K Microsoft Excel Worksheet Functions 0 18th May 2009 09:05 PM
How to customize number to 10 digits including 2 digits after deci =?Utf-8?B?Q2FyaW5h?= Microsoft Excel Worksheet Functions 3 20th Sep 2007 02:50 AM
Combining Times and digits hcj Microsoft Excel Misc 0 25th Jun 2004 08:37 PM


Features
 

Advertising
 

Newsgroups
 


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