extract all numbers (double digit) in excel and sum

sosolid4u09

New Member
Joined
Feb 8, 2018
Messages
6
Hi everyone,

I have a bit of a complex problem.

I have a column like the following;

Training: 7, Fighting: 12, Speed: 3

I need a formula that sums together 7+12+3 automatically.

Now I got a solution where i extract all the digits in that cell and sum. But that ends up giving me 7+1+2+3 which is obviously not correct.

Does anyone have an idea?

Thanks
 
I think an User Defined Function (UDF) should be the proper solution.

Anyway, this array formula worked for your examples


[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
A
[/TD]
[TD="bgcolor: #DCE6F1"]
B
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD]
Text​
[/TD]
[TD]
Result​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD]
Training: 7, Fighting: 12, Speed:3​
[/TD]
[TD]
22​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD]
Training: , Fighting: 12, Speed:​
[/TD]
[TD]
12​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
4
[/TD]
[TD]
Training: 0, Fighting: , Speed: 3​
[/TD]
[TD]
3​
[/TD]
[/TR]
</tbody>[/TABLE]


Array Formula in B2 copied down
=SUM(IFERROR(0+TRIM(MID(SUBSTITUTE(SUBSTITUTE(":"&A2,":",REPT(" ",500)),",",REPT(" ",500)),ROW(A$1:A$100)*500,500)),0))

confirmed with Ctrl+Shift+Enter, not just Enter

M.

Just to confirm - this also works!

thanks a lot
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
For any number of numbers, set to 100 as max value (confirm with Ctrl + Shift + Enter):

=SUM(IF(ISNUMBER(FIND(" "&ROW($1:$100)&" "," "&SUBSTITUTE(A1,",","")&" ")),ROW($1:$100),0))
 
Upvote 0
This array-entered** formula appears to work correctly...

=SUM(ROW($1:$99)*(LEN(A1&",")-LEN(SUBSTITUTE(A1&",",RIGHT(" "&ROW($1:$99),2)&",","")))/3)

**Confirm this formula using CTRL+SHIFT+ENTER and not just Enter by itself
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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