adding digits of a number
Slight update, you don't have to enter these with CTRL+SHIFT+ENTER. Also
note my formulas don't depend on the length of your number, you can have as
long or as short a number as you would like:
Even positions:
=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:"&LEN(A1))),2)=0),--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))
Odd positions:
=SUMPRODUCT(--(MOD(ROW(INDIRECT("1:"&LEN(A1))),2)=1),--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))
--
Regards,
Dave
"David Billigmeier" wrote:
Assume cell A1, need to enter these formulas with CTRL+SHIFT+ENTER as they
are array formulas:
To add the odd numbers:
=SUMPRODUCT(IF(MOD(ROW(INDIRECT("1:"&LEN(A1))),2)= 1,--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),0))
To add the even numbers:
=SUMPRODUCT(IF(MOD(ROW(INDIRECT("1:"&LEN(A1))),2)= 0,--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),0))
--
Regards,
Dave
"dantee" wrote:
Hello.
Does anyone knows a function or formula that would add the digits of a
number and spit out a result?
Example.... take the number 1092836103274 (all by itself in a cell)
add the 1st, 3rd, 5th digits and so on to get 1+9+8+6+0+2+4=30
or add the 2nd, 4th, 6th digits and get the result of 0+2+3+1+3+7=16
curious
dantee.
|