Finds three dates after each other in one paragraph. Needed to locate numbers as in example.
The format of date is not configurable, that can be in next version
Function DateDateDate(Stri, AgainstDate, Flag1_RightColEdgar, Optional DateFormat = "mmmm dd, yyyy")
' Finds location of Date, Date, date inside Stri
' Having AgainstDate as 1st of those three dates
' 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)
'
' Returns index of first date found of these 3 dates
' Needs CutString11(), Frequency(), VBInstr()
Rett = 0
D1Found = VBInstr(AgainstDate, Stri) ' location of our date
If D1Found = 0 Then GoTo ByeBye
' If we have 2 dates after me, then we return D1Found
Search4 = ", "
Search4Found = (Frequency(DateFormat, Search4) - 1) * 2 ' How many found in our date
D2 = CutString11(Stri, Search4, Search4Found, Search4, Search4Found, D1Found)
D3 = CutString11(Stri, Search4, Search4Found * 2, Search4, Search4Found, D1Found)
D2 = Trim(Replace(D2, "and", ""))
D3 = Trim(Replace(D3, "and", ""))
If IsDate(D2) And IsDate(D3) Then
Rett = D1Found
End If
ByeBye:
DateDateDate = Rett
End Function
' Finds location of Date, Date, date inside Stri
' Having AgainstDate as 1st of those three dates
' 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)
'
' Returns index of first date found of these 3 dates
' Needs CutString11(), Frequency(), VBInstr()
Rett = 0
D1Found = VBInstr(AgainstDate, Stri) ' location of our date
If D1Found = 0 Then GoTo ByeBye
' If we have 2 dates after me, then we return D1Found
Search4 = ", "
Search4Found = (Frequency(DateFormat, Search4) - 1) * 2 ' How many found in our date
D2 = CutString11(Stri, Search4, Search4Found, Search4, Search4Found, D1Found)
D3 = CutString11(Stri, Search4, Search4Found * 2, Search4, Search4Found, D1Found)
D2 = Trim(Replace(D2, "and", ""))
D3 = Trim(Replace(D3, "and", ""))
If IsDate(D2) And IsDate(D3) Then
Rett = D1Found
End If
ByeBye:
DateDateDate = Rett
End Function
Stri, AgainstDate, Flag1_RightColEdgar, Optional DateFormat = "mmmm dd, yyyy"
Views 359
Downloads 42
CodeID
DB ID
ANmarAmdeen
610
Revisions
v1.0
Sunday
March
3
2024