Talismanic
05-21-2001, 05:32 AM
I have a field in a query that I want to round up to the nearest whole number. How do I do this? Here is the field:
Numb: [MonTimesEmpPay]
Numb: [MonTimesEmpPay]
|
View Full Version : Rounding Up Talismanic 05-21-2001, 05:32 AM I have a field in a query that I want to round up to the nearest whole number. How do I do this? Here is the field: Numb: [MonTimesEmpPay] Mike Gurman 05-21-2001, 06:47 AM if you want to round upwards only to the next highest integer, i.e. 1.9 becomes 2, but 1.1 also becomes 2, then: Numb: Int([MonTimesEmpPay]+1) will do it, except for the unfortunate side effect of rounding 1.0 to 2, so something like: Numb: Iif([MonTimesEmpPay]=int([MonTimesEmpPay]),[MonTimesEmpPay],Int([MonTimesEmpPay]+1)) Which willonly attempt to round up non-integer values. HTH Mike ErikRP 04-12-2002, 08:36 AM I have a similar problem and hopefully someone has a solution. I have a number to 2 decimal places, which is in percent. I need to round this number to the next highest tenth. For example: 91.10% = 91.1% 91.11% = 91.2% I know this follows no logical mathematical standard, but that's what I need... Any ideas how to get this? I used the above formula, but it rounds to the nearest whole number. I've tried using 0.1 at the end, but it didn't help. Maybe dividing by? Multiplying by? Help! http://www.access-programmers.co.uk/ubb/smile.gif David R 04-12-2002, 08:51 AM I would try Int([PercentField]*1000+0.9)/1000 Which basically takes your .9111, makes it 911.1+.9 or 912.0, and then drops it back down to .912. Adding .9 instead of 1.0 means you can avoid the Iif() statement Mike Gurman suggested. HTH, David R ErikRP 04-12-2002, 10:30 AM It worked great, David! That's 2 I owe you for this week! Thanks for your all of your help! |