How to sum numbers that form an integer

RomulusMilea

Board Regular
Joined
May 11, 2002
Messages
175
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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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,213,482
Messages
6,113,908
Members
448,532
Latest member
9Kimo3

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