Want to understand the below formulae

uttamkumar1234

New Member
Joined
Aug 26, 2015
Messages
9
HI,

PLEASE EXPLAIN ME THE BELOW MENTIONED FORMULAE WITH EXAMPLE.

SUMPRODUCT(--MID(H13,ROW(INDIRECT("1:" & LEN(H13))),1))

<tbody>
</tbody>

THANKS.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
It's taking a number and adding up all the digits, e.g. 198732 produces 30 1+9+8+7...

It extracts each digit in H13 and using an array adds them up.
INDIRECT("1:"&LEN(H13)) produces a count 1,2,3,4,5 etc up to the length of the number. Each digit is then placed into the MID(H13...,1) to extract the 1st 2nd 3rd etc character
SUMPRODUCT then adds them up
 
Upvote 0
HI,

PLEASE EXPLAIN ME THE BELOW MENTIONED FORMULAE WITH EXAMPLE.

SUMPRODUCT(--MID(H13,ROW(INDIRECT("1:" & LEN(H13))),1))

<tbody>
</tbody>

THANKS.

It sums up the digits of a number.

01. MID is used to extract each digit...

Let H13 = 26.

MID(H13,2,1)

>> 6

That is, the digit at position 2.

02. ROW function can be used to produce a sequence like {1,2}...

ROW(INDIRECT("1:"&LEN(H13))

>>

ROW(INDIRECT("1:2"))

>>

{1,2}

03. SumProduct like Sum can sum a set of numbers from a range or an array


04. From above, we get using...

SUMPRODUCT(--MID(H13,ROW(INDIRECT("1:" & LEN(H13))),1))

>>

SUMPRODUCT(--MID(H13,ROW(INDIRECT("1:" &2)),1))

>>

SUMPRODUCT(--MID(H13,ROW(INDIRECT("1:2")),1))

>>

SUMPRODUCT(--MID(H13,{1;2},1))

>>

SUMPRODUCT(--MID(21,{1;2},1))

>>

SUMPRODUCT(--{"2";"1"})

>>

SUMPRODUCT({2;1})

>> 3

which is the sum of the digits of the numeric string of H13. Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,216,027
Messages
6,128,381
Members
449,445
Latest member
JJFabEngineering

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top