Adding digits in the same cell

I have the numbers from 0-999 in a column and i need to add the digits of each number and make a second column. eg. the sum of the digits of 123 is 6
What is the formula for doing this for any number of digits in a cell?

Nick's picture

assuming your data starts in

assuming your data starts in A1.. enter this in B1, and copy it down:

=IF(A1<10,A1,LEFT(A1,1)+RIGHT(A1,1))+IF(A1>99,MID(A1,2,1),0)

Say thanks, by "liking" here:

; - >

Nick