Adding numbers within a sentance

hutchyp

New Member
Joined
May 22, 2014
Messages
4
I'm trying to create a formula to add numbers within a sentence. For example, Passed 4 of 4 Courses Passed 4 of 5 Courses. I want to add all the 4's.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
You could use a UDF. This udf will handle as many "Passed" in a cell exists, but fails if y in "Passed x of y courses" is triple digits. In a module input the following
Code:
Function PassedCourses(target As Range)
    startnum = 1
    lookhere = 1
Do
    lookhere = InStr(startnum, target, "Passed")
    startnum = lookhere + 1
        If lookhere = 0 Then GoTo answer
    coursespassed = Mid(target, Len("Passed") + startnum, 1) * 1
    totalpassed = coursespassed + totalpassed
    i = i + 1
Loop
answer:
    PassedCourses = totalpassed
End Function
 
Upvote 0

Forum statistics

Threads
1,206,921
Messages
6,075,584
Members
446,147
Latest member
homedecortips

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