NumberNumberNumber

Finds 3 numbers in a string by ignoring characters between them.
    ' example
    ' Common stock (par value $1.00 per share; 70.0 million shares authorized; 55.0 million, 53.2 million, and 52.5 million shares issued and outstanding
    '    at December 31, 2023, September 30, 2023, and December 31, 2022, respectively)

CodeFunctionName
What is this?

Public

Tested

Original Work
Function NumberNumberNumber(Stri, Optional Ignoring = "million|and|,| ")
    ' Finds a 3 numbers after one another inside a long string
    '    Returns the index of the first of these 3 numbers
    '    Needs CutString11(), VBInstr_Numeric()
    Rett = 0
    N1Found = 0
    Search4 = " "
    Search4Found = 1
    Do
        N1Found = VBInstr_Numeric(Stri, N1Found + 1)
        If N1Found = 0 Then Exit Do
        N2 = CutString11(Stri, Search4, Search4Found, Search4, Search4Found * 2, N1Found)
        N3 = CutString11(Stri, Search4, Search4Found * 3, Search4, Search4Found * 3, N1Found)
        N2 = Trim(ReplaceStrings(N2, Ignoring, ""))
        N3 = Trim(ReplaceStrings(N3, Ignoring, ""))
       
        If IsNumeric(N2) And IsNumeric(N3) Then
            Rett = N1Found
            Exit Do
        End If
        DoEvents
    Loop
   
ByeBye:
    NumberNumberNumber = Rett
End Function

Stri, Optional Ignoring = "million|and|,| "

Views 245

Downloads 35

CodeID
DB ID