Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there something that I should know about function lenght an
numbers? I have used this in a loop: [vb] Left (start, Len(start)-2) [vb] with "start" being a number that changes from 5.0 to 110.5. An Len(start) always returns 8 as lenght of the number?? What am I doing wrong -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
normally I would suggest not to use string operations on numbers. what are you trying to achieve with this function - there may be better solutions. But if you want to use Len you may try Left (CStr(start), Len(CStr(start))-2) -- Regards Frank Kabel Frankfurt, Germany Is there something that I should know about function lenght and numbers? I have used this in a loop: [vb] Left (start, Len(start)-2) [vb] with "start" being a number that changes from 5.0 to 110.5. And Len(start) always returns 8 as lenght of the number?? What am I doing wrong? --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Have you declared start as a type Double? If so, you are getting the length
of a double variable, 8 bytes. This only works properly on a string variable. You could trying casting to string like Len(CStr(start)) but be aware that 5.0 will return 1, as the value is 5. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "dreamer " wrote in message ... Is there something that I should know about function lenght and numbers? I have used this in a loop: [vb] Left (start, Len(start)-2) [vb] with "start" being a number that changes from 5.0 to 110.5. And Len(start) always returns 8 as lenght of the number?? What am I doing wrong? --- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hmm, Cstr also doesn't do what I want.
Is there any other way to do this -- Message posted from http://www.ExcelForum.com |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In addition to Bob
Len(Format(start,"0.0")) would return 3 for the value 5.0 -- Regards Frank Kabel Frankfurt, Germany Bob Phillips wrote: Have you declared start as a type Double? If so, you are getting the length of a double variable, 8 bytes. This only works properly on a string variable. You could trying casting to string like Len(CStr(start)) but be aware that 5.0 will return 1, as the value is 5. "dreamer " wrote in message ... Is there something that I should know about function lenght and numbers? I have used this in a loop: [vb] Left (start, Len(start)-2) [vb] with "start" being a number that changes from 5.0 to 110.5. And Len(start) always returns 8 as lenght of the number?? What am I doing wrong? --- Message posted from http://www.ExcelForum.com/ |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dreamer < postulated on 2/25/2004 8:03 AM:
Is there something that I should know about function lenght and numbers? I have used this in a loop: [vb] Left (start, Len(start)-2) [vb] with "start" being a number that changes from 5.0 to 110.5. And Len(start) always returns 8 as lenght of the number?? What am I doing wrong? --- Message posted from http://www.ExcelForum.com/ To count the number of digits to the left of the decimal point . . . =INT(LOG10(A3))+1 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dreamer,
Have you got your problem figured out yet? The way you wrote ".0" makes me think your seing "5.0" with your eyes? Where are you seeing it? (msgbox, immediate window, a cell inside Excel) Sincerely, David Fixemer |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
cell lenght MUST be always 30 | Excel Discussion (Misc queries) | |||
How to convert number in to time lenght, minutes and seconds? | Excel Discussion (Misc queries) | |||
Max Formula Lenght | Excel Discussion (Misc queries) | |||
Lenght of sheets | Excel Worksheet Functions | |||
Lenght of a decimal part of a number. | Excel Worksheet Functions |