For fun, I took this formula and asked ChatGPT to convert it to a VBA Function (with comments):
Function extractText(cell As Range) As String
' Declare an array of search terms
Dim searchTerms As Variant
searchTerms = Array("Banner", "EBL2", "Movie Art", "Use as is", "TTT", "Generic")
' Initialize start and end positions to 0
Dim startPos As Long
startPos = 0
Dim endPos As Long
endPos = 0
' Loop through search terms and find the first occurrence of any of them in the cell
For Each searchTerm In searchTerms
startPos = WorksheetFunction.Search(searchTerm, cell)
If startPos > 0 Then
Exit For
End If
Next searchTerm
' If none of the search terms were found, try finding "Customs" or "Custom"
If startPos = 0 Then
startPos = WorksheetFunction.Search("Customs", cell)
If startPos = 0 Then
startPos = WorksheetFunction.Search("Custom", cell)
End If
End If
' If none of the above were found, try finding "Generic"
If startPos = 0 Then
startPos = WorksheetFunction.Search("Generic", cell)
End If
' If none of the search terms were found, return an empty string
If startPos = 0 Then
extractText = ""
Else
' Loop through search terms and find the next occurrence of any of them after the start position
For Each searchTerm In searchTerms
endPos = WorksheetFunction.Search(searchTerm, cell, startPos + 1)
If endPos > 0 Then
Exit For
End If
Next searchTerm
' If none of the search terms were found after the start position, set the end position to the end of the cell
If endPos = 0 Then
endPos = Len(cell) + 1
End If
' Extract the text between the start and end positions
extractText = Mid(cell, startPos, endPos - startPos)
End If
End Function
Edit: Sadly this doesn't work at all lol, and after half an hour of prompting ChatGPT can't figure out why, it just gets stuck in a loop :-(