SUM numeric values within cells that contain text & numbers

slam

Well-known Member
Joined
Sep 16, 2002
Messages
921
Office Version
  1. 365
  2. 2019
Hi all! Hope everyone is having an amazing weekend!

I have a lot of cells that contain both text, numbers, and then a number within parenthesis that will always be at the end of the text. I want to SUM the numbers within parenthesis.

For instance, if I had the cells as per below, I am looking to have the result displayed as 60, i.e. it is only performing the SUM on cells that have a number within parenthesis (which I have bolded), and ignoring the others. Performing the calculation after Text to columns is not an option for me.

Text 1 (30)
40% Text 2
50%
200
Text 3 (10)
Text 4
+3 / 35%
Text 5 (20)

Is this possible?

Thanks!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Like this?

23 06 04.xlsm
AB
1Text 1 (30)60
240% Text 2
30.5
4200
5Text 3 (10)
6Text 4
7+3/35%
8Text 5 (20)
Sum
Cell Formulas
RangeFormula
B1B1=SUM(IFERROR(-REPLACE(A1:A8,1,FIND("(",A1:A8)-1,""),0))
 
Upvote 0
Solution
Hi Peter,

Thank you so much for the quick reply. When I set my data up just like yours, it worked perfectly, but after reading about the REPLACE function, I'm not clear why it won't work when I update it to match my current cell references, where I want the output in B13 (then will drag across to B14, B15, etc.)

Excel Formula:
=SUM(IFERROR(-REPLACE(B3:B12,1,FIND("(",B3:B12)-1,""),0))
 
Upvote 0
B13 (then will drag across to B14, B15, etc.)
Dragging across from B13 does not get you to B14, B15 etc, it gets you to C13, D13 etc.

Is this what you are trying to do? If not, please give us some dummy sample data and the expected results with XL2BB and explain again in relation to that sample data.

23 06 04.xlsm
ABCDEF
1
2
3Text 1 (30)Text 1 (30)Text 1A (1)
440% Text 240% Text (2)40% TextB (2)
50.50.50.5C (3)
6200200200D (4)
7
8
9Text 3 (10)Text 3 (10)Text 3E (5)
10Text 4Text 4Text 4F (6)
11+3/35%+3/35%+3/35%G (7)
12Text 5 (20)Text 5 (20)Text 5H (8)
1360620036
Sum
Cell Formulas
RangeFormula
B13:F13B13=SUM(IFERROR(-REPLACE(B3:B12,1,FIND("(",B3:B12)-1,""),0))
 
Upvote 1
Hi Peter, yes, B13, C13, D13, etc is what I meant :)

Your data setup is exactly what I have, but I was still not getting it to work..... until..... I was able to get it working when entering it as an array formula.

Thank you!
 
Upvote 0
until..... I was able to get it working when entering it as an array formula.
OK, you must be using your 2019 version then as 365 doesn't require array entry. I made the assumption that you would be using 365 :oops: :)
 
Upvote 1
Ah, understood, and thank you for explaining. I use 365 at work, and 2019 at home, and should have explained this was for 2019; my apologies, and thank you for your patience. Had not realized there could be a difference between them for this, but I will always specify in the future.
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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