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


A
B
1
Text​
Result​
2
Training: 7, Fighting: 12, Speed:3​
22​
3
Training: , Fighting: 12, Speed:​
12​
4
Training: 0, Fighting: , Speed: 3​
3​

<tbody>
</tbody>


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

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
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
Oops, the conception should be further developped as now it adds only once numbers which appear more than once!
 
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,215,446
Messages
6,124,900
Members
449,194
Latest member
JayEggleton

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