ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RIGHT function doesn't read 0's (https://www.excelbanter.com/excel-programming/433259-right-function-doesnt-read-0s.html)

nikita[_2_]

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?

Mike H

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?


joeu2004

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.


Patrick Molloy[_2_]

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?



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com