公式返回错误我需要将值0赋给#Error [英] Formula returns error I need to assign value 0 to #Error

查看:103
本文介绍了公式返回错误我需要将值0赋给#Error的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的表格中,我有两个字段说 fld1 fld2。 fld1 1,2,3,8,20 等数据。现在我需要计算 fld1 的长度并将其分配给 fld2 他在这个例子中 fld2必须有5 。我用了

= Len([fld1]) - Len(替换([fld1],,,,和))+ 1

这样做但是当fld1包含空值时,它会在fld2中返回错误,如 #Error 。如果fld1中没有值,我在fld2中需要0


请帮我解决这个问题

In my form i have two fields say fld1 and fld2. fld1 have data like 1,2,3,8,20. now I need to calculate the length of fld1 and assign it to fld2 he in this example fld2 must have 5. I used

=Len([fld1])-Len(Replace([fld1],",",""))+1
to do that but when fld1 contains null value it returns an error in fld2 like "#Error". I need 0 in fld2 if theres no value in fld1


help me please to solve this

推荐答案

你好。你可以使用Nz函数返回一个空字符串来代替fld1的空值:
Hi. You can use the Nz function to return an empty string in place of the null value for fld1:
展开 | 选择 | Wrap | 行号


他没有'这真的意味着长度 Len中的字符串( string )Stewart。他有一个字符串,由一个人在某个月内错过的日期组成,即01,11,14,15,16。他想要一个月的总天数,在这种情况下为5.


使用 Nz()不能在这里工作,因为即使该字段为空,你仍然会得到1作为缺席数。他需要首先检查null,然后相应地采取行动:
He doesn''t really mean the "length" of the string as in Len(string) Stewart. He has a string made up of dates that a person has missed from work during a given month, i.e. "01, 11,14,15,16" and he wants a month''s total of the number of days, in this case 5.

Using Nz() won''t work here, because even if the field is null, you''ll still get 1 as the number of absences. He''ll need to check for null first, then act accordingly:
展开 | 选择 | Wrap | 行号



他并不是指长度。 Len中的字符串( string )Stewart。他有一个字符串,由一个人在某个月内错过的日期组成,即01,11,14,15,16。他想要一个月的总天数,在这种情况下为5.


使用 Nz()不能在这里工作,因为即使该字段为空,你仍然会得到1作为缺席数。他需要首先检查null,然后相应地采取行动:
He doesn''t really mean the "length" of the string as in Len(string) Stewart. He has a string made up of dates that a person has missed from work during a given month, i.e. "01, 11,14,15,16" and he wants a month''s total of the number of days, in this case 5.

Using Nz() won''t work here, because even if the field is null, you''ll still get 1 as the number of absences. He''ll need to check for null first, then act accordingly:
展开 | 选择 | Wrap | 行号


这篇关于公式返回错误我需要将值0赋给#Error的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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