IF Formula Help

Justinian

Well-known Member
Joined
Aug 9, 2009
Messages
1,557
Office Version
  1. 365
Platform
  1. Windows
In cell A2 is the number 78.13. I am trying to write a formula that rounds A2 down if the last digits is between 0 and 5 and round up if the last is between 6 and 9. This formulas does round down if the number is less than 5 but it will not round up when the number is 5 or greater.

=IF(AND(RIGHT(A2)<5,RIGHT(A2)>0),ROUNDDOWN(A2,0),ROUNDUP(A2,0))
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
The RIGHT function is treating A2 as text instead of a number. Try;

=IF(AND(INT(RIGHT(A2))<5,INT(RIGHT(A2)>0)),ROUNDDOWN(A2,0),ROUNDUP(A2,0))
 
Upvote 0
or this:
=IF(RIGHT(ROUND(A2,2),1)+0<=5,ROUNDDOWN(A2,0),ROUNDUP(A2,0))
 
Upvote 0
OK, I am an idiot. I must have input the formula incorrectly because this is now working for me:

=IF(RIGHT(A2)<49,ROUND(A2,2)*100,ROUND(B3,2)*100)
 
Upvote 0

Forum statistics

Threads
1,221,230
Messages
6,158,662
Members
451,507
Latest member
aexis48d

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