四舍五入 [英] Rounding

查看:98
本文介绍了四舍五入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表格中有一个开始和结束时间,我通过使用

diff:(DateDiff(" n",[Start],[End]))找到总时间/>

我想把这个数字四舍五入到最接近的15分钟(计费期)。

我试过

rounddif:CInt([diff] / 15)* 15

但它向上或向下舍入到最近的15.我我想强迫它总是围捕。

例如。 6分钟将轮到15,33分钟将轮到45等等


任何帮助将不胜感激。


我正在使用MS Access 2007

I have a Start and End time in a table which I find the total time by using
diff: (DateDiff("n",[Start],[End]))

I then want to round this figure up to the nearest 15mins (billing period).
I tried
rounddif: CInt([diff]/15)*15
but it rounds up or down to the nearest 15. I want to force it to always round up.
eg. 6min would round to 15, 33mins would round to 45, etc

Any help would be greatly appreciated.

I am using MS Access 2007

推荐答案


我在表格中有一个开始和结束时间,我通过

diff:(DateDiff(" n",[Start],[End]))


然后我想把这个数字四舍五入到最接近的15分钟(结算)期)。

我试过

rounddif:CInt([diff] / 15)* 15

但它向上或向下舍入到最近的15.我我想强迫它总是围捕。

例如。 6分钟将轮到15,33分钟将轮到45等等


任何帮助将不胜感激。


我正在使用MS Access 2007
I have a Start and End time in a table which I find the total time by using
diff: (DateDiff("n",[Start],[End]))

I then want to round this figure up to the nearest 15mins (billing period).
I tried
rounddif: CInt([diff]/15)*15
but it rounds up or down to the nearest 15. I want to force it to always round up.
eg. 6min would round to 15, 33mins would round to 45, etc

Any help would be greatly appreciated.

I am using MS Access 2007



tmdan。


试试这个

rounddif:Round([diff] / 15)* 15

Hi, tmdan.

Try this
rounddif: Round([diff]/15)*15


谢谢你,但它仍然会返回相同的结果。


还有其他想法吗?
Hi, thanks for that but it still returns the same result.

Any other ideas?



您好,谢谢,但它仍然会返回相同的结果。


还有其他想法吗?
Hi, thanks for that but it still returns the same result.

Any other ideas?



这个小函数将在15分钟时执行正确的''Round Up。间隔''最长为2小时的差异:

This little Function will perform the proper ''Round Up at 15 min. Intervals'' for a differential of up to 2 hours:

展开 | 选择 | Wrap | 行号


这篇关于四舍五入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆