从Excel到VBA的时差视图 [英] Difference time view from Excel to VBA

查看:46
本文介绍了从Excel到VBA的时差视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法获得某些活动从开始到结束的平均时间,

I can't obtain the average time from start to end of some activities,

我每天尝试减1K的方法,但结果均不正确.图像可以更好地解释(我的英语).在此示例中,我的活动总和为480:52:56小时,在vba中,我得到了不同的结果,对于vba,日期为"19/01/1900 00:52:56",例如456:52:56 hous减去24小时为什么会有这种差异?以及如何获得相同的结果?

I tried 1K way but the result isn't correct, every time I've one day minus. the image can explain better (that my english). In this example the sum of my activities il 480:52:56 hours, in vba I've different result, for vba the date is "19/01/1900 00:52:56" like 456:52:56 hous 24 hours minus why this difference? and how I can obtain the same result?

感谢您的任何建议

推荐答案

由于您的评论,我了解到问题出在1900年3月1日,所以我更改了选择范围:

thanks to your comments I understand that the problem is for the minor dates of March 1, 1900 so I changed the select from:

Select [DataAttesa] as Data, avg(iif([totHours] > 1 and [totHours] < 61, dateadd("d",-1,CDate([totHours])) , [totHours])) as nr FROM [db_In$] Where TypeTrasp  = "AOG" group by [DataAttesa] Order by [DataAttesa]asc

现在,当我将recordset.results放在excel上时,该值是正确的.谢谢

now, when I put the recordset.results on excel the value are correct. Thank at all

这篇关于从Excel到VBA的时差视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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