Hi all,
I would request anyone to unravel the following formula as i am unable to understand it's logic.
=SUMPRODUCT(MID(A1,ROW(OFFSET($A$1,,,LEN(A1))),1)+0)
Thank you
It's identical to:
=SUMPRODUCT(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)+0)
The ROW bit creates an integer array of 1 to the length of the value in A1...
If A1 is 6718, the length of A1 is 4. So we need an integer array of 1, 2, 3, and 4.
The OFFSET bit will produce:
{1;2;3;4}
Fed to MID, we get:
MID(A1,{1;2;3;4},1)
===>
{"6";"7";"1";"8"}
which is an array of text numbers.
If you coerce this using +0, we get:
{6;7;1;8}
Fed to SumProduct, we get: 22