How to sum numbers that form an integer

RomulusMilea

Board Regular
Joined
May 11, 2002
Messages
181
Hello all,

Is there a possibility (a function, or a formula) to obtain sum of numbers that form a certain integer. I have a list with hundreds for integers. For example if my list contains integer 123456789, that formula should return 45. Thank you in advance.
Romulus.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Assuming your integer is in cell A1, enter the following array formula in any other cell:

=SUM(VALUE(MID(A1,ROW($A$1:OFFSET($A$1,LEN(A1)-1,0)),1)))

Press Ctrl+Shift+Enter (not just Enter) after typing the formula.
 
Upvote 0
On 2002-09-03 00:40, Andrew Poulsom wrote:
Assuming your integer is in cell A1, enter the following array formula in any other cell:

=SUM(VALUE(MID(A1,ROW($A$1:OFFSET($A$1,LEN(A1)-1,0)),1)))

Press Ctrl+Shift+Enter (not just Enter) after typing the formula.

Excellent answer,

just to expand a little, if may,

a non array entered way (Just enter) would be to use SUMPRODUCT:

=SUMPRODUCT(VALUE(MID(A1,ROW($A$1:OFFSET($A$1,LEN(A1)-1,0)),1)))

Also, it's important to note that if you needed this for a value in say A87 you need to keep the absolute references to A1 intact:

=SUMPRODUCT(VALUE(MID(A87,ROW($A$1:OFFSET($A$1,LEN(A87)-1,0)),1)))
 
Upvote 0

Forum statistics

Threads
1,218,743
Messages
6,144,225
Members
450,531
Latest member
avril18

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