Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default RIGHT function doesn't read 0's

If I use RIGHT,2 on a cell with the value 30.00, it's output is 3, not
0. What's going on here?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default RIGHT function doesn't read 0's

Hi,

If the cell is formatted a number with 2 decomal places then the output of

=RIGHT(A1,2)

Should be 30

The reason can be seen if you select the cell and look in the formula bar,
the .00 bit is a format that you see but the real content og the cell is 30.
Enter 30.01 and the same formula will output 01 because now the .01 bit is
'real' and not a format.


Mike

"nikita" wrote:

If I use RIGHT,2 on a cell with the value 30.00, it's output is 3, not
0. What's going on here?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,059
Default RIGHT function doesn't read 0's

"nikita" wrote:
If I use RIGHT,2 on a cell with the value 30.00,
it's output is 3, not 0.


Use RIGHT(TEXT(A1,"0.00"),2).


What's going on here?


With RIGHT(A1,2), if A1 is a numeric, it is really difficult to know what
you will get. For example, put 1E-16 into A1 and look RIGHT(A1,2). Then
put 1E-28 into A1.

It seems that in that form, the RIGHT result depends on how the numeric
value appears in the Formula Bar; and that is unspecified, AFAIK. (Although
we might be able to reverse-engineer the rules.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default RIGHT function doesn't read 0's

what the cell contains and what you see depends upon whatever formattign you
have, when you use a STRING function on a cell containiong a number you'll
get these 'strange' results
fro example , type 30 into any unformatted cell, then format to 2 dps. Nowin
the immediate window type
?right(selection.text,5)
I get
0.00 whe I'd have expected to see 30.00
... there's a trailing space. so specifically format numbers before you test
them with string functions is the rule!






"nikita" wrote:

If I use RIGHT,2 on a cell with the value 30.00, it's output is 3, not
0. What's going on here?

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
Read specific time in NOW() function Smith512 Excel Worksheet Functions 2 December 4th 09 10:26 PM
Read Matrix via function Dan Excel Programming 2 January 26th 09 10:14 PM
read next two cells over using Large function Knox Excel Programming 0 March 8th 07 08:03 PM
<REQ Can anyone help me build a function, please read.... Shankley Excel Worksheet Functions 9 May 10th 06 03:10 AM
How this function is read? Mike Excel Programming 2 January 5th 06 07:03 PM


All times are GMT +1. The time now is 03:24 AM.

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

About Us

"It's about Microsoft Excel"