Adding numbers within the cell

xoxo

Board Regular
Joined
Mar 29, 2009
Messages
198
Hi all, I am xoxo and new to this forum.

Would like help on how to calculate numbers within a cell. Say, I have these numbers in A1: 01-02-03-04-05 and I want A2 to give me the sum of all the numbers in A1 without the dash. Is it possible?

Thank you very much!
xoxo
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
try
=SUMPRODUCT(MID(SUBSTITUTE(A1,"-",""),ROW(INDIRECT("1:"&LEN(SUBSTITUTE(A1,"-","")))),1)+0)
 
Upvote 0
Thank you for the help.

It works for 01-02-03-04-05.

When I apply the formula to a cell with 10-21-24-35-46, how do I go about in doing this? It gave me 28 as the sum, when it should be 136. Thanks.
 
Upvote 0
Prior to Excel 2007, look at menu Data | Text to Column

Check for additional information in Excel help.

If your text string is consistent, you can build a formula such as

=SUM((MID(A5,{1,4,7,10,13},2)+0))
 
Upvote 0
As another approach you could use =EVAL(SUBSTITUTE(A5,"-","+")) which would require the numbers to be consistent.
 
Upvote 0
You can use Jeff's approach without the add-in if you define a named formula. It will refer, however, to a cell with a fixed relative offset.

Ex.:

- Select Sheet1!B1

- Define the name:

Name: SumIn
Refers to: =EVALUATE(SUBSTITUTE(Sheet1!A1,"-","+"))

Now you can use this named formula to calculate the cell to the left.

Ex:

C10: 23-1-100-2000
D10: =SumIn

The result in D10 will be 2124.
 
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,734
Members
448,987
Latest member
marion_davis

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