0

I have a drop down list (data validation) that populates other cells using vlookup that pulls data from a separate worksheet. I'd like to include an error message if the field is blank like "No data entered". However, I am getting "0" instead. Here is the formula I used:

=IFERROR(VLOOKUP(ChildName,Children,6,FALSE),"No data entered") 

I then changed this to an ISERROR:

=IF(ISERROR(VLOOKUP(ChildName,Children,5,FALSE))=FALSE,"No data entered", VLOOKUP(ChildName,Children,5,FALSE))

This gives the error message appropriately but now my drop down list does not populate the other cells! What am I doing wrong? Thank you!

4

1 回答 1

2

查看您的公式,我看到两个值得注意的点:

  1. 在 IFERROR 中返回第 6 列,在 ISERROR 中返回第 5 列!
  2. 在 ISERROR 中,如您所说,当发现某些内容时会显示错误消息=IF(ISERROR=FALSE,ErrorMsg,...)!要解决您的问题,只需使用以下公式:
    =IF(ChildName="","未输入数据",IFERROR(VLOOKUP(ChildName,Children,6,0),"找不到"&ChildName))

啊,我明白了!看看这个问题 -有返回 0 的 Excel 公式,使结果为空。它显示了所有方式。

我最喜欢的是=IFERROR(1/1/VLOOKUP(ChildName,Children,6,0),"No data!")。仅适用于数字。

否则,使用=IF(VLOOKUP(ChildName,Children,6,0),VLOOKUP(ChildName,Children,6,0),"No data!").

为了安全起见,这个版本应该解决所有潜在的问题:=IFERROR(IF(VLOOKUP(ChildName,Children,6,0),VLOOKUP(ChildName,Children,6,0),"No data!"),"No data!")

于 2013-03-29T22:40:21.440 回答