Comparing Floating Point For Greater Than or Equal To

dbmathis

Well-known Member
Joined
Sep 22, 2002
Messages
1,064
Hi All,

I am working with rating scales and I need to be able to check to see if a floating point number is >= another number with VBA. I only need 2 decimal places for my comparisons. I

For example I on my worksheet I have two different cells that have 40 in them. and do >= it returns false.

Code looks like:

Code:
    For rating_scale_range = ws2.Cells(Rows.Count, numeric_value_column).End(xlUp).Row To row_number_rating_scale Step -1
        If ws2.Cells(row_number_ratings, raw_normalized_rating_column) >= ws2.Cells(rating_scale_range, normalized_threshold_value_column) Then
            ' Numeric
            ws2.Cells(row_number_ratings, calculated_manager_numeric_rating_column) = ws2.Cells(rating_scale_range, numeric_value_column)
            ' Normalized
            ws2.Cells(row_number_ratings, calculated_manager_normalized_rating_column) = ws2.Cells(rating_scale_range, normalized_value_column): Exit For
        End If
    Next

Is there a way to do this?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,224,509
Messages
6,179,192
Members
452,893
Latest member
denay

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