#Error:除以0时
大家好,
我在我的querry中有这个sql来计算费率:
比率:([是] /([是] + [否]) )。在我的报告中,我将字段的格式设置为百分比,但是当Yes + No的总和= 0时,它显示#Error,并且我不希望报告具有#Error。 ,而是我想说:Dem 0,然后我修改我的sql如下:
Rate:IIf(([Yes] + [No])= 0,Dem 0,([是] /([是] + [否])))
Dem 0适用于具有demoniator = 0的那些,但是我不能将表单上的格式设置为百分比。再说,所以它会说0.333333,而不是%,因为那些带有妖魔的人并不是真正的0。
有人可以帮忙吗?基本上,我想摆脱#Error,当demoninator = 0时,但仍能保持%格式。
谢谢!
bluemoon
Hi all,
I have this sql in my querry to calcuate the rate:
Rate:([Yes]/([Yes]+[No])). And in my report, I set the format of the field to "percentage", but then when the sum of Yes + No is =0, it shows #Error, and I do not want the report to have "#Error", instead I would like it to say: "Dem 0", then I modify my sql as follow:
Rate: IIf(([Yes]+[No])=0,"Dem 0",([Yes]/([Yes]+[No])))
the "Dem 0" works well for the ones with demoniator=0, but then I can''t set the format on the form to "percentage" anymore, so it''ll say 0.333333, instead of %, for the ones with demoniator is not euqal to 0.
Can someone please help? basically, I would like to get rid of the "#Error", when the demoninator =0, but still be able to keep the % format.
Thank you!
bluemoon
我试过这种方式并且运行良好,但后来我遇到了问题,例如#0.333333333,当* 100,它变成33.33333333,我怎么能只削减33.33?
率:IIf(([是] + [否])= 0,Dem 0,([是] / ([是] + [否])* 100&%))
谢谢!
bluemoon
I tried this way and it works well, but then I run into the problem of, for example # such as 0.333333333, when *100, it becomes 33.33333333, how can I cut of at 33.33 only?
Rate: IIf(([Yes]+[No])=0,"Dem 0",([Yes]/([Yes]+[No])*100 &"%"))
thank you!
bluemoon
尝试
IIf([是] + [否])= 0,Dem 0,格式(([是] / [是] + [否] ]),百分比))
Try
IIf ( [Yes]+[No])=0,"Dem 0", Format( ([Yes]/[Yes]+[No]), "Percent") )
由于百分比,它不起作用。在报价单中,我试图放(),但也没用。
谢谢!
bluemoon
Hi, it doesn''t work, because of "percent" in quotation, I''ve tried to put (), but did not work either.
thanks!
bluemoon