View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein \(MVP - VB\)[_965_] Rick Rothstein \(MVP - VB\)[_965_] is offline
external usenet poster
 
Posts: 1
Default User Defined FUNCTION

Give this UDF a try (assuming you wanted it named Truc as posted)...

Function Truc(S As String) As String
If S Like "????0000" Then
Truc= Left(S, 4)
Else
Truc= S
End If
End Function

Rick


"EAK" wrote in message
...
I need a User Defined Function that check if a number or string is 8 digits
long and ends in "0000". If it meets the two creteria, then it should drop
those the "0000" and return only the remaining 4 numbers for example,

23000016 result 23000016
23160000 result 2316
19000000 result 1900

FYI using Substitute() gives me the wrong result sometimes.

FUNCTION Truc(location)

END Function