How to sum numbers that form an integer

RomulusMilea

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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
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.
 

Ian Mac

MrExcel MVP
Joined
Feb 20, 2002
Messages
1,174
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)))
 

Forum statistics

Threads
1,144,056
Messages
5,722,261
Members
422,419
Latest member
Havok390

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
Top