getting the sum of numbers in a string

LFKim2018

Active Member
Joined
Mar 24, 2018
Messages
267
I have data in a cell of 1 to maximum of 10 numbers with + sign in between them, but they can not be added as yet for they are part of a string. How would be the formula or the function for its sum?
example:
Column A Column B
1+9.5 sum formula (10.5)
2+11+100 sum formula (113)
37+50+9+7.75 sum formula (103.75)
4+3+1000+77+1+10 sum formula (1095)
and so on....
up to a combination of ten numbers - always with a plus sign in between the numbers.
the numbers can be any number with or without decimal.
using of helper columns is ok.
many many thanks
 
Last edited:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Define the following in the Name Manager:
Name: Sum_String
Refers to: =EVALUATE(INDIRECT("RC[-1]",0))

Now, enter =Sum_String in column B and drag-copy down as needed.
 
Upvote 0
Define the following in the Name Manager:
Name: Sum_String
Refers to: =EVALUATE(INDIRECT("RC[-1]",0))

Now, enter =Sum_String in column B and drag-copy down as needed.

Mr. Tetra201
Thank you for your reply.
pardon my ignorance, how do I define in the Name manager ?
where do I do it?
many thanks
 
Upvote 0
You could also try this direct formula approach.

Excel Workbook
AB
11+9.510.5
22+11+100113
337+50+9+7.75103.75
44+3+1000+77+1+101095
Evaluate sum
 
Upvote 0
If you wanted to avoid the volatile function INDIRECT and you knew there would be no more than, say, 9 numbers to add you could use:
=SUMPRODUCT(MID(SUBSTITUTE(A1&REPT("+0",9),"+",REPT(" ",100)),{1,2,3,4,5,6,7,8,9}*100-99,100)+0)

If there could be lots of numbers to add and you wanted to avoid the volatile function, post back as a longer, non-volatile, version could be constructed.
 
Upvote 0
If you wanted to avoid the volatile function INDIRECT and you knew there would be no more than, say, 9 numbers to add you could use:
=SUMPRODUCT(MID(SUBSTITUTE(A1&REPT("+0",9),"+",REPT(" ",100)),{1,2,3,4,5,6,7,8,9}*100-99,100)+0)

If there could be lots of numbers to add and you wanted to avoid the volatile function, post back as a longer, non-volatile, version could be constructed.

Mr. Peter_SSs
That was NEAT!!
the formula though is very very long....
Thank you very very much for the new insight.
 
Upvote 0
If you wanted to avoid the volatile function INDIRECT and you knew there would be no more than, say, 9 numbers to add you could use:
=SUMPRODUCT(MID(SUBSTITUTE(A1&REPT("+0",9),"+",REPT(" ",100)),{1,2,3,4,5,6,7,8,9}*100-99,100)+0)

If there could be lots of numbers to add and you wanted to avoid the volatile function, post back as a longer, non-volatile, version could be constructed.

Mr. Peter_ SSs
I noticed you say 9 numbers, I tested it for 10 and it worked too..
many many thanks
 
Last edited:
Upvote 0
I noticed you say 9 numbers, I tested it for 10 and it worked too..
:confused: Can you give an example where that works for 10 numbers? It doesn't work for me. By manual calculation this result should be 55, not the 45 returned by the formula.

Excel Workbook
AB
51+2+3+4+5+6+7+8+9+1045
Evaluate sum
 
Upvote 0
:confused: Can you give an example where that works for 10 numbers? It doesn't work for me. By manual calculation this result should be 55, not the 45 returned by the formula.

Evaluate sum

AB
51+2+3+4+5+6+7+8+9+1045

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:175px;"><col style="width:76px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
B5=SUMPRODUCT(MID(SUBSTITUTE(A5&REPT("+0",9),"+",REPT(" ",100)),{1,2,3,4,5,6,7,8,9}*100-99,100)+0)

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Mr. Peter_SSs
Not only did I tested it for 10, I go as far as 15! and it gave the correct sum.
I have a snipped image but I don't know how to attach it here.
I also have the sample workbook.
thank you
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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