I'm trying to create a user defined function that returns everything to the left of the last hyphen in a string. All strings will be formatted like this:
- CT2986-400427-15
- J84705-202001-12
- TF230068-003
- DS2112-000038-11
This is my current code, but it keeps displaying a #VALUE! error in the cell. Any ideas?
Function PartNOSUFFIX(PartNo As String) As String
PartNOSUFFIX = Left(PartNo, InStr(8, PartNo, "-") - 1)
End Function
Thanks in advance!