ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Less than numbers issue please help (https://www.excelbanter.com/excel-programming/340733-less-than-numbers-issue-please-help.html)

DKY[_88_]

Less than numbers issue please help
 

I'm trying to do a conditional with some cells that are formatted like
so.

Range("B" & i & ":S" & i).NumberFormat = "0"

(so that they show up as whole numbers)

and I'm running the If like so

If Range("R" & i).Value < "0.5" Then
color the row

the problem is that its catching the 0.5's and stuff but for some
reason its not catching the 0.0833333 which in my math education is
less than 0.5 but for some reason its not registering as less than 0.5.
Does anyone know why?


--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=469586


Tom Ogilvy

Less than numbers issue please help
 
try using the number 0.5 and not a string containing the characters 0 . 5

If Range("R" & i).Value < 0.5 Then

--
Regards,
Tom Ogilvy

"DKY" wrote in message
...

I'm trying to do a conditional with some cells that are formatted like
so.

Range("B" & i & ":S" & i).NumberFormat = "0"

(so that they show up as whole numbers)

and I'm running the If like so

If Range("R" & i).Value < "0.5" Then
color the row

the problem is that its catching the 0.5's and stuff but for some
reason its not catching the 0.0833333 which in my math education is
less than 0.5 but for some reason its not registering as less than 0.5.
Does anyone know why?


--
DKY
------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=469586




DKY[_89_]

Less than numbers issue please help
 

That does the trick, thanks. I knew it would be something easy

--
DK
-----------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...fo&userid=1451
View this thread: http://www.excelforum.com/showthread.php?threadid=46958



All times are GMT +1. The time now is 09:56 AM.

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