Splitting numbers from cells and sum them

S

stakar

Hi!
I need a FUNCTION that it will do the following:

I have cells with values from 1 to 45. I want to split the numbers i
the cells and then to sum them. The results will be of course to othe
cells.

So if i have the number 45 it will be 4+5=9
So if i have the number 10 it will be 1+0=1
So if i have the number 5 it will be 5

But
If i have the num 29 it will not be 2+9=11 but 2 (1+1)
or
i have the num 28 it will not be 2+8=10 but 1 (1+0)

Thats because i always want as result one digit number so if the firs
results isnt one digit number it has to continue the splitting !

Thanks in advanc
 
J

Jerry W. Lewis

Just take each condition in turn and handle it in nested IF's

=IF(LEN(A1)=1,A1, IF(LEFT(A1,1)+RIGHT(A1,1)<10,LEFT(A1,1)+RIGHT(A1,1),
LEFT(LEFT(A1,1)+RIGHT(A1,1),1)+RIGHT(LEFT(A1,1)+RIGHT(A1,1),1)))

Jerry
 
Top