Val function in excel (1 Viewer)

Leo_Polla_Psemata

Registered User.
Local time
Yesterday, 16:43
Joined
Mar 24, 2014
Messages
364
Hi,
in Access, we may have a text field like this Tare Weight 2100.000KG , and by using the Val function, we can make it like this Tare: Val([Tare Weight]) = 2100
Is there something similar and simple in excel?
To have a cell "10 t" and in function =sum, ignore text and use only digits ?
 

Leo_Polla_Psemata

Registered User.
Local time
Yesterday, 16:43
Joined
Mar 24, 2014
Messages
364
Amazingly the nearest thing is the Value() function.
Hi, not exactly, this convert a string that represent a number to a number
For example =VALUE("$1,000") converts to 1000

In my case, i have a cell 15 t (stands for 15 tones) , i cannot make calculation with only the number in it.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:43
Joined
May 7, 2009
Messages
19,237
you can create a Function and call it:
Code:
Public Function mySum(r As Range)
Dim rng As Range, val As Double
Dim sUOM As String
    For Each rng In r
        If Len(sUOM) = 0 Then
            On Error Resume Next
            sUOM = Trim$(Split(rng, " ")(1))
            On Error GoTo 0
        End If
        val = val + CDbl(Split(rng, " ")(0))
    Next
    If Len(sUOM) Then
        mySum = val & " " & sUOM
    Else
        mySum = val
    End If
End Function
 

Gasman

Enthusiastic Amateur
Local time
Today, 00:43
Joined
Sep 21, 2011
Messages
14,287
Why not your own function with just
Code:
YourFunctionname = Val(WhateverYouPassToTheFunction)
 

Users who are viewing this thread

Top Bottom