birchtree Posted January 3, 2002 Posted January 3, 2002 I wrongly posted these request to the Left Brain Forum. I think it belongs here. Hello Can someone help with what should be a simple calculation? I sell material by the square foot. Any amount greater than a whole number needs to be rounded up to the next whole number. If the result is 10.1 I need the result to be 11. Thanks alot.
Geeksharka Posted January 3, 2002 Posted January 3, 2002 I would round off the number first, from 10.1 to 10 for example (use the Round function, and set precision to 0). 10.5 and higher will go to 11 10.4 or lower will go to 10 so... have your calc field first round it off, and then wrap it all in an IF statement where if the result is LESS THAN the original, it adds 1 to the amount, and if the result is more than the original, it adds 0 (or uses the rounded amount) I would do this in a separate Calc field, and not reset it the original field. Extra memory, but easier to chekc for errors if the original field is left alone. Here's the Calc: If(Round(number_original, 0) >number_original, Round(number_original, 0), Round(number_original, 0) + 1) number_original: is your primarty field number_rounded: is the Calc field (result) Sharka
rdhaden Posted January 3, 2002 Posted January 3, 2002 Since you're talking about building materials, negative numbers are not an issue, so this will work: Case(Number - Truncate(Number, 0) != 0, Truncate(Number, 0) + 1, Number) If you wanted it to work with negative numbers, then this will work: Case(Number - Truncate(Number, 0) != 0, Case(Number < 0, -1 * (Abs(Truncate(Number, 0)) + 1), Truncate(Number, 0) + 1), Number)
birchtree Posted January 3, 2002 Author Posted January 3, 2002 quote: Originally posted by rdhaden: Since you're talking about building materials, negative numbers are not an issue, so this will work: Case(Number - Truncate(Number, 0) != 0, Truncate(Number, 0) + 1, Number) If you wanted it to work with negative numbers, then this will work: Case(Number - Truncate(Number, 0) != 0, Case(Number < 0, -1 * (Abs(Truncate(Number, 0)) + 1), Truncate(Number, 0) + 1), Number) Thanks for the quick reply
Thom Posted January 3, 2002 Posted January 3, 2002 Either of these will work: roundUp1(calc,number) = Int(number) + (Int(number) < number) roundUp2(calc,number) = Round(number + .49999999, 0)
Recommended Posts
This topic is 8431 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