4 is more than 5??

b0unce

Board Regular
Joined
Apr 22, 2009
Messages
75
Hello,

I have this strange issue when I try to round up all the figures 1-4 to 5. Let's say I have a value of 6.74 in cell A1 and want to round it up to 6.75. I use a function in A2:
=if(and(right(A1;1)>=1;right(A1;1)<5);roundup(A1;2)-0.05;A1)
But the strange thing is that "right(A1;2)<5" is evaluated as false. I tried this function using alone, but it just gives False all the time. Once I change "<" to ">" I get true. Though 4 is less than 5.
Is this an Excel bug, or I am using this function wrong? A1 is a calculated value, rounded to 2 figures. But even if I use fixed value it does not work either.
I am using Excel 2010.

Maybe anyone has other ideas, how can I roundup all 0.01 - 0.04 value to 0.05? Please share.
Thank you in advance!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Right is a text function, that could be messing with the results here:

try

=if(and(right(A1;1)*1>=1;right(A1;1)*1<5);roundup(A1;2)*1-0.05;A1)

 
Upvote 0
Hello,

I have this strange issue when I try to round up all the figures 1-4 to 5. Let's say I have a value of 6.74 in cell A1 and want to round it up to 6.75. I use a function in A2:

But the strange thing is that "right(A1;2)<5" is evaluated as false. I tried this function using alone, but it just gives False all the time. Once I change "<" to ">" I get true. Though 4 is less than 5.
Is this an Excel bug, or I am using this function wrong? A1 is a calculated value, rounded to 2 figures. But even if I use fixed value it does not work either.
Text values are always larger than numeric values... the result of the RIGHT function is a text string, 5 is a number. If you add 0 to a text string that looks like a number, Excel will treat it as a number. So, try your comparison this way...

(0+RIGHT(A1;2))<5
 
Upvote 0
if you use right(A1;2)<5 then 2 numbers from right will be used in your example the 74

but you can use

=CEILING(A1;0,05)
 
Upvote 0
Have a look at using this formula. It may help with what you are trying to do:

=CEILING(A1,0.05)
 
Upvote 0
Hey guys,

thank you very much for help!
I also figured out, that I could just use VALUE function to convert the string I received from using RIGHT to number.
CEILING is also a great solution! Thanks for sharing your knowledge!
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,520
Members
449,088
Latest member
RandomExceller01

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