Function calPP(inputStr As String) As Double
Dim dimensions() As String
dimensions = Split(inputStr, "*")
If UBound(dimensions) < 2 Then
MsgBox "Input format error, please make sure the input contains 3 numbers separated by '*'."
B1 = 0
Exit Function
End If
Dim od As Double, id As Double, ln As Double
od = CDbl(Replace(dimensions(0), "mm", ""))
id = CDbl(Replace(dimensions(1), "mm", ""))
ln = CDbl(Replace(dimensions(2), "mm", ""))
Dim volume As Double, mass As Double
volume = (od - id) * ln * 8.96
mass = volume / 1000
calPP = mass
End Function
Why can't the code get results
Cell A1 Key in OD9.525*0.8mm*850mmL
formula like this ((9.525-0.8)*850*8.96)/1000
Cell B1 Get result is 66.4496
Bookmarks