Excel function for sum of digits

MissRibena

Registered User
Messages
350
Hi everyone

I know that the FACT function in Excel is for Factorial (n!) but is there one for sum of the digits (i.e. 6+5+4+3+...)?

Thanks
Rebecca
 
Hi Rebecca,

try SYD

from excel help
Returns the sum-of-years' digits depreciation of an asset for a specified period.

Syntax

SYD(cost,salvage,life,per)

Cost is the initial cost of the asset.

Salvage is the value at the end of the depreciation (sometimes called the salvage value of the asset).

Life is the number of periods over which the asset is depreciated (sometimes called the useful life of the asset).

Per is the period and must use the same units as life.


ajapale
 
Hi Rebecca,

The following works better

Use this formula

(N+1)*(N)/2

eg for the sum of the digits 20+19+18 etc

(20+1)*20/2 = 210


QED!

This works because you are pairing and adding the hightest (N) and the lowest (1) and the second highest (N-1) and the second lowest 2 etc. You meet half way and have N/2 such pairs. Each pair ends up N+1, N-1+2, N-2+3 etc so the solution is N/2*(N+1)

aj
 
Thanks Clubman,

I learned this from a marvellous Christian Brother who was my maths/physics/applied maths teacher many years ago.

He used to recite a rebel song which made the use of pairs in mathematics more memorable;

"They shot them in pairs coming down the stairs, Dick Treacy and Dan Breen"

aj
 
Yeah - we used to have one head(case) brother who used to go around wearing a stetson and singing "Oh Lord it's so hard to be humble" and used to encourage visiting missionaries to tell stories about "the niggers".