Search code examples
exceldecimalroundingdataformat

Rounding numbers based on decimals value excel


I have problem in Excel which i couldn't handle on my own. So, I have a datasheet in "dd.mm.rrrr hh:mm" format, which shows when a particular process has been finished. When i want to subtract these values to get info how long did it take i will get results like: 6,666667 or 3,33333 or 7,14242.

So i would like to extract integer and then, basing on condition add 0 or 0,5 or 1 to this value. Something like that: If decimal is higher than 0,5 -> add 1, If decimal is between 0,3 and 0,5 then add 0,5, If decimal is lower than 0,3 then add 0 to Integer.


Solution

  • Try a formula along these lines:

    =A1+IF(MOD(A1,1)>0.5,1,IF(MOD(A1,1)>=0.3,0.5,0))
    

    enter image description here