ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   specific rounding of formulas which may need to include an IF stat (https://www.excelbanter.com/excel-worksheet-functions/8673-specific-rounding-formulas-may-need-include-if-stat.html)

Gerry Wilkins

specific rounding of formulas which may need to include an IF stat
 
I am currently working on a worksheet where i would like to round the value
in a cell (the cells currently contain a formula which has been rounded to 0
decimal places). The rule being that if the last digit (before the decimal
place) is the number 0, 1,2,3 or 4 then round up the last digit to the digit
5. If the number is 5,6,7,8 or 9 then round up the last digit to 9. I would
like to know how to write this formula.

For example
if the value is 493.75 then round up to 495.
if the value is 498.75 then round up to 499.
if the value is 1233.75 then round up to 1235.
if the value is 1238.75 then round up to 1239.

JE McGimpsey

One way:

=CEILING(INT(A1)+0.1,5)-(MOD(A1,10)=5)

In article ,
"Gerry Wilkins" <Gerry wrote:

I am currently working on a worksheet where i would like to round the value
in a cell (the cells currently contain a formula which has been rounded to 0
decimal places). The rule being that if the last digit (before the decimal
place) is the number 0, 1,2,3 or 4 then round up the last digit to the digit
5. If the number is 5,6,7,8 or 9 then round up the last digit to 9. I would
like to know how to write this formula.

For example
if the value is 493.75 then round up to 495.
if the value is 498.75 then round up to 499.
if the value is 1233.75 then round up to 1235.
if the value is 1238.75 then round up to 1239.


Ola

Hi,

Here is one solution:
=IF((A1-TRUNC(A1/10,0)*10)<5,5,9)+TRUNC(A1/10,0)*10

Ola



All times are GMT +1. The time now is 06:39 AM.

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