Results 1 to 5 of 5

How to extract numbers for calculation when entering a string of text into a cell

Threaded View

  1. #1
    Forum Contributor
    Join Date
    10-02-2021
    Location
    Thailand
    MS-Off Ver
    365
    Posts
    190

    How to extract numbers for calculation when entering a string of text into a cell

    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
    Last edited by choletseng; 02-23-2024 at 08:41 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Extract numbers from text string
    By Delta729 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-18-2018, 04:54 PM
  2. [SOLVED] Extract numbers from text string
    By cmb80 in forum Excel General
    Replies: 3
    Last Post: 05-22-2017, 05:17 AM
  3. Extract Several Numbers From Text String
    By mvl3589 in forum Excel General
    Replies: 5
    Last Post: 06-21-2016, 08:11 PM
  4. [SOLVED] Extract numbers from text string
    By reynoldslarry in forum Excel General
    Replies: 6
    Last Post: 10-25-2014, 03:22 PM
  5. extract and sum numbers from a text string
    By Shazwb in forum Excel General
    Replies: 5
    Last Post: 08-28-2011, 09:24 PM
  6. Extract numbers from text string
    By mkvassh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-24-2009, 08:53 AM
  7. [SOLVED] EXTRACT NUMBERS FROM TEXT STRING
    By fiber_doc in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-28-2005, 02:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1