Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thu, 23 Oct 2003 07:15:21 -0700, "Josh in Tampa"
wrote: Function TrimZip(OrigVal) If InStr(OrigVal, "-") Then OrigVal = Left(OrigVal, (Len(OrigVal) - InStr (OrigVal, "-"))) End If End Function when i use it in my worksheet, i get 0 (zero) instead of a trimmed zip code. supposed to work like this.....if it finds something like: 33534-0098, it will trim it down to 33534. any ideas? thanks in advance!!! Your function returns the value in TrimZip. Since you never set it, it contains a 0. Try: Function TrimZip(OrigVal) If InStr(OrigVal, "-") Then TrimZip = Left(OrigVal, (Len(OrigVal) - InStr(OrigVal, "-"))) End If End Function --ron |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
what's wrong with this function? | Excel Discussion (Misc queries) | |||
What's wrong with this IF function. | Excel Discussion (Misc queries) | |||
What is Wrong with this function?????????? | Excel Worksheet Functions | |||
What am I doing wrong with PMT function? | Excel Discussion (Misc queries) | |||
INDIRECT Function - what am I doing wrong? | Excel Discussion (Misc queries) |