Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I'm using the following function to format the number of decimals to
show: Function FormatDecimal(strValue As String) As String On Error Resume Next Dim arrArray As Variant arrArray = Split(strValue, ",") If Len(arrArray(1)) = 0 Then FormatDecimal = arrArray(0) If Len(arrArray(1)) = 1 Then FormatDecimal = FormatNumber(strValue, 1) If Len(arrArray(1)) = 2 Then FormatDecimal = FormatNumber(strValue, 2) If Len(arrArray(1)) = 3 Then FormatDecimal = FormatNumber(strValue, 3) End Function If strValue = "115" the above function returns "115,000" which is wrong. I want it to return "115". The reason is that Len(arrArray(1)) = "Index outside interval" in this case. Can someone please help me? Regards, S |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Custom functions calculating time arguments Help Desperate | Excel Worksheet Functions | |||
How can I use Excel to solve an equation? | Excel Worksheet Functions | |||
Date & Time | New Users to Excel | |||
Automatically up date time in a cell | Excel Discussion (Misc queries) | |||
Conversion | Excel Worksheet Functions |