Ignoring text after number?

afc171

Board Regular
Joined
Jan 14, 2017
Messages
148
Office Version
  1. 2013
Platform
  1. Windows
Hi all,
How can I add up totals (range F8:F17) but ignore any text after the number?


23.5
4MG
5 ml

so total would be 32.5 ?

Thank you
 
Are the numbers with text always single digits?
Can you post a more complete example?
With 2013, possibly array enter.

T202501a.xlsm
FG
823.5
94MG
105 ml
1132.532.5
4g
Cell Formulas
RangeFormula
F11F11=SUM(IF(ISNUMBER(F8:F10),F8:F10,--LEFT(F8:F10)))
G11G11=SUMPRODUCT(IF(ISNUMBER(F8:F10),F8:F10,--LEFT(F8:F10)))
 
Upvote 0
If you're up to VBA, a very simple function could help with this:

VBA Code:
Function ConvertValue(r As Range) As Double
Dim c As Range
For Each c In r
    ConvertValue = ConvertValue + Val(c)
Next
End Function

Then in your spreadsheet:
=ConvertValue(F8:F10)
 
Upvote 0
Solution
If you're up to VBA, a very simple function could help with this:

VBA Code:
Function ConvertValue(r As Range) As Double
Dim c As Range
For Each c In r
    ConvertValue = ConvertValue + Val(c)
Next
End Function

Then in your spreadsheet:
=ConvertValue(F8:F10)

Thanks for you help guys, this seems to work pretty well. Cheers.
 
Upvote 0

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