The Headache Posted September 16, 2009 Posted September 16, 2009 Hi Have searched for the answer but can't find. I have a number field that returns a decimal. I would like to round 1.5 and under to 1 and 1.6 and over to 2 etc. I think this should be easy but haven't found the ceiling, floor, round calcs or any combination to work. Thanks so much! Note: Using XP 8.5 Advanced (at work)
The Headache Posted September 16, 2009 Author Posted September 16, 2009 Hi I think I got it. Round ( Truncate ( Abs (zzDays since receiving - zzElapsedTimeSetUp)/30 ; 1 ) ;0 ) This has a few other things thrown in but basically it's Round ( Truncate ( NumberField ; 1 ) ;0 ) Thanks for the mind field!
Raybaudi Posted September 16, 2009 Posted September 16, 2009 Hi try: Let([ n = YourNumberField ; d = Length ( Mod ( n ; 1 ) ) ]; Round ( n - 10 ^ - d * Sign ( n ) ; 0 ) )
Lee Smith Posted September 16, 2009 Posted September 16, 2009 doesn' this do the same thing? Round ( YourNumber ; 0 )
The Headache Posted September 16, 2009 Author Posted September 16, 2009 Comment / Lee You're both absolutely right! (Especially Comment lol) I didn't quite understand the the "precision" part of the calc when using 0. : Thanks for your time.
Raybaudi Posted September 17, 2009 Posted September 17, 2009 doesn' this do the same thing? Round ( YourNumber ; 0 ) no... Round ( 1.5 ; 0 ) returns 2 and not 1 as asked. P.S.: it wasn't asked but my calc also reverts the rounding for negative numbers, so that -1.5 rounds up to -1
Newbies aedificat1 Posted September 17, 2009 Newbies Posted September 17, 2009 Another approach round( yourNumber - .1, 0)
Recommended Posts
This topic is 5604 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now