Calculate numbers within one cell, when certain criteria is met

Microsoft

Board Regular
Joined
Jun 16, 2016
Messages
108
Hi Guys,

As the title suggests I would like to perform a sum on a group of numbers, which will be in one cell, with text associated with them (the text lines will always remain the same, example data below)

[TABLE="width: 500"]
<tbody>[TR]
[TD]Data[/TD]
[TD]Answer[/TD]
[/TR]
[TR]
[TD]Rob 5
Jack 10
Stan 5
Denise 17[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

The above shows how I would like my calculation to work, if the criteria was to state that the sum should only be performed on the numbers which are on the same line as Rob, and Jack. Stan and Denise's figures should be ignored.

Is this possible to do? Ideally I'd like to avoid VBA as this workbook will be used in O365 by multiple people.

Thanks in advance!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
A SUMIF isn't possible, as the values are all in the same cell (A1 in the example)

Thank you for your response.
 
Upvote 0
Your example data (assume put in A1) is not consistent, try this formula in B1:

=SUM(0+TRIM(MID(SUBSTITUTE(SUBSTITUTE(" "&A1,CHAR(10)," ")," ",REPT(" ",99)),{2,4}*99,99)))

or this,

=SUM(0+TRIM(MID(SUBSTITUTE(SUBSTITUTE(" "&A2,CHAR(10),"")," ",REPT(" ",99)),{2,4}*99,99)))

Regards
Bosco
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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