Office中国论坛/Access中国论坛

标题: [分享]真正的四舍五入的函数 [打印本页]

作者: zhuyiwen    时间: 2003-9-10 18:40
标题: [分享]真正的四舍五入的函数
  1. Public Function RoundToLarger(dblInput As Double, intDecimals As Integer) As Double
  2.    
  3.     'Implements a variant of the Round() function, that rounds-to-larger
  4.     'rather than rounds-to-even:
  5.         
  6.     Dim strFormatString As String 'Format string
  7.    
  8.     'If input is zero, just return zero. Else format as appropriate:
  9.     If dblInput <> 0 Then
  10.         strFormatString = "#." & String(intDecimals, "#")
  11.         RoundToLarger = Format(dblInput, strFormatString)
  12.     Else
  13.         RoundToLarger = 0
  14.     End If
  15.    
  16. End Function
复制代码
转自: http://www.tek-tips.com/faqs.cfm?spid=705&amp;rat1=10&amp;sfid=3734
  1. ? Round(2.385, 2)
  2. 2.38
  3. ? RoundToLarger(2.385, 2)
  4. 2.39
复制代码

作者: ail    时间: 2003-11-17 08:28
但为何1500*4123却得数带小数了,不明
作者: ail    时间: 2003-11-17 08:29
还有1.255*3得数是3.76而不是3.77,更不明了
作者: aronliu    时间: 2007-6-30 04:33
HI
作者: 5988143    时间: 2007-6-30 16:57
謝謝分享
作者: silkzhou    时间: 2007-7-2 17:54
lk
作者: sunmyth    时间: 2007-7-3 17:56
不可不看!
作者: lanfeng125    时间: 2007-7-22 00:22
不是吧,这么麻烦!!!!!!!![em18]
作者: whl0049    时间: 2007-7-24 19:36
正需要这个,看看!!!!!11
作者: zxzx2733    时间: 2007-7-24 20:03
看看
作者: liselect    时间: 2007-7-27 16:10
!~~~~~~~~~~~~~
作者: ziling_dan    时间: 2007-7-27 16:14
看一下。
作者: 真主    时间: 2007-9-3 14:53
谢谢分享,我看看怎样写的
作者: leoyan76    时间: 2007-9-12 11:27
seeeeeeeeeeeeeeeeeeee
作者: afterain    时间: 2007-11-9 14:47
下载下来学习学习!!!
作者: XWQ2000    时间: 2007-12-1 11:08
:lol :lol
作者: cnwang    时间: 2008-1-3 11:21
tt
作者: guoanxiang    时间: 2008-1-16 12:58
好东西呀!我要看看!
作者: wysizhh    时间: 2008-2-18 09:09
看看
作者: newplayer    时间: 2008-2-28 09:15
是真的吗?
回复一下看看
作者: Henry D. Sy    时间: 2008-5-26 12:27
thanks for your share
作者: zss427607    时间: 2008-5-26 13:08
正需要这个
作者: ABCaccess    时间: 2008-6-1 11:16
谢谢你与大众分享
作者: yedaoan    时间: 2008-6-8 08:54
1111111111111111111
作者: lh19700925    时间: 2009-3-27 22:33
1# zhuyiwen
作者: yuayua23    时间: 2009-3-27 22:40
谢谢学习
作者: jenny0612    时间: 2009-6-5 13:51
看看
作者: chaojianan    时间: 2009-11-7 10:51
谢谢分享。
作者: goto2008    时间: 2009-11-12 15:56

作者: 石三少    时间: 2009-12-2 12:57
我来看看是什么
作者: summer_jt    时间: 2010-1-6 09:52
看看
作者: styhs    时间: 2010-1-6 13:41

作者: xryacc2    时间: 2010-1-10 23:12
看看是什么好东东
作者: c101    时间: 2010-1-10 23:47
謝謝分享
作者: yhf    时间: 2010-1-21 14:02
看看
作者: yanwei82123300    时间: 2010-1-21 14:33
謝謝分享
作者: 简    时间: 2010-3-24 17:45
我也被四舍五入困惑着,我也看看~~~
作者: sxb2007    时间: 2010-4-3 22:05
看看
作者: longdoupj    时间: 2010-7-1 13:56
学习学习~~~~~~~~``
作者: china086    时间: 2010-8-4 11:50
看看
作者: STD    时间: 2010-11-30 13:47
学习下
作者: lzongb    时间: 2010-12-1 22:43
look
作者: xyh2732    时间: 2010-12-17 23:39
ffffffffff
作者: YXH_YXH    时间: 2011-3-13 23:57
多谢!!!!!!
作者: 文棣    时间: 2011-3-14 14:26
用得着
作者: nature876    时间: 2011-6-11 17:36
学下


作者: hxn    时间: 2011-6-14 19:35
study
作者: william_yao    时间: 2012-4-25 15:45
学习!!!
作者: yanghua1900363    时间: 2012-4-25 16:59
xuexi xuex
作者: jingan    时间: 2012-4-29 11:51
好东东学习
作者: dfang    时间: 2012-4-29 13:16
正需要




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3