Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default lenght of a number

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default lenght of a number

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default lenght of a number

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default lenght of a number

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default lenght of a number

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default lenght of a number

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default lenght of a number

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cell lenght MUST be always 30 JABAgdl Excel Discussion (Misc queries) 5 February 19th 10 08:19 PM
How to convert number in to time lenght, minutes and seconds? Bojan Excel Discussion (Misc queries) 3 November 3rd 08 07:35 AM
Max Formula Lenght Milind Keer[_2_] Excel Discussion (Misc queries) 3 September 3rd 08 06:40 PM
Lenght of sheets Dupie1 Excel Worksheet Functions 2 March 18th 08 07:31 PM
Lenght of a decimal part of a number. Yara Excel Worksheet Functions 4 October 5th 07 10:27 PM


All times are GMT +1. The time now is 02:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"