VBA Comparison Operators and Percentages Question

Status
Not open for further replies.

avd88

Board Regular
Joined
Jan 18, 2016
Messages
112
Trying to condense the issue I have from an original question I asked yesterday but haven't gotten a reply.

Have the following statement: If x < y then (do something)

I'm comparing percentages, but coming across the following issue:

If 102.98% < 103% then <------ This runs the code which is correct.
If 103.00% < 103.00% then <------ This is also running the code which is my problem because it shouldn't run it.
If 103.10% < 103.00% then <----- This does not run the code which is correct.

Anyone knows why this is happening? Tried switching the order of a grid so I could use >= instead of < but I'm still having a problem when the two numbers to compare are equal percentages. For example rounding 118.95% to 119.0% and comparing it to 119%.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Duplicate to: VBA Less Than Issue

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top