ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comparison Operators (https://www.excelbanter.com/excel-programming/365060-comparison-operators.html)

Devanath Ong

Comparison Operators
 
When two variables are declared as either single or double and used for
comparison, pls see below

Note that try1 and try2 are getting the value from excel worksheet, in this
case, may be
both are 508.19

double try1
double try2

when the following statement is executed, the excel micro will issue an
error try1 not equal to try2 even if both have the values of 508.19

if try1 < try2
generate eror message ' try1 not equal to try2'
end-if

Does anybody know why?



Barb Reinhardt

Comparison Operators
 
Why don't you print out the difference of the two?

debug.print try1, try2, try1-try2

It might help you figure out your problem.

"Devanath Ong" wrote:

When two variables are declared as either single or double and used for
comparison, pls see below

Note that try1 and try2 are getting the value from excel worksheet, in this
case, may be
both are 508.19

double try1
double try2

when the following statement is executed, the excel micro will issue an
error try1 not equal to try2 even if both have the values of 508.19

if try1 < try2
generate eror message ' try1 not equal to try2'
end-if

Does anybody know why?



[email protected]

Comparison Operators
 
Hi
Are they really both EXACTLY 508.19, or is that only to 2 decimal
places?
regards
Paul

Devanath Ong wrote:
When two variables are declared as either single or double and used for
comparison, pls see below

Note that try1 and try2 are getting the value from excel worksheet, in this
case, may be
both are 508.19

double try1
double try2

when the following statement is executed, the excel micro will issue an
error try1 not equal to try2 even if both have the values of 508.19

if try1 < try2
generate eror message ' try1 not equal to try2'
end-if

Does anybody know why?




All times are GMT +1. The time now is 12:43 PM.

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