This is a test sentence. (500 Points) The idea is to extract the points values from the cell and calculate the total. (800 Points) My question is; can it be done? And how? (500 Points)
The bolded sentence above is in Cell A1. In cell B1, I'd like to enter a formula to calculate the "points" value of all the values in brackets. How would I go about this. Any help is appreciated. TX
PS: The value in the above will calculate to: 1800. :)
Calculate points
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Calculate points
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78524
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Calculate points
I'd put the text and the points in separate cells. But if you really want to use a single cell, create this custom function in a module:
In cell B1, enter the formula
=GetPoints(A1)
Code: Select all
Function GetPoints(varValue) As Double
Dim intPos1 As Integer
intPos1 = InStr(varValue, "(")
Do While intPos1 > 0
GetPoints = GetPoints + Val(Mid(varValue, intPos1 + 1))
intPos1 = InStr(intPos1 + 1, varValue, "(")
Loop
End Function
=GetPoints(A1)
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Calculate points
I'd agree, but this is a clients request and I have no control over their spreadsheets.
Many TX for the custom function. Appreciate it stax!
Many TX for the custom function. Appreciate it stax!
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.