Given that you are using 2007
In D3
=IFERROR(INDEX('Company names'!B:B,MATCH(IF(ISNUMBER(SEARCH(" at ",E3,1)),TRIM(MID(E3,SEARCH(" at ",E3,1)+LEN(" at "),255)),IF(ISNUMBER(SEARCH("@",E3,1)),TRIM(MID(E3,SEARCH("@",E3,1)+1,255)),"-")),'Company names'!A:A,0),1)),"-")
Drag/Fill Down
2003 will require a helper column, see the attached.
All versions could use this UDF in a standard module
Function GetURL(rng As Range)
Dim strTemp As String
Select Case True
Case InStr(1, rng, " at ") > 0
strTemp = Trim(Mid(rng, InStr(1, rng, " at ") + Len(" at "), 255))
Case InStr(1, rng, "@") > 0
strTemp = Trim(Mid(rng, InStr(1, rng, "@") + 1, 255))
Case Else
GetURL = "-"
Exit Function
End Select
If strTemp <> "" Then
With WorksheetFunction
GetURL = .Index(Sheets("Company Names").Range("A:B"), .Match(strTemp, Sheets("Company Names").Range("A:A"), 0), 2)
End With
End If
End Function
Enter in D3
Drag/Fill Down
Bookmarks