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

あなたの式を見ると、注目に値する2つの点がわかります。

  1. IFERROR では 6 列目を返し、ISERROR では 5 列目を返します。
  2. ISERROR では、あなたが言うように、何かが見つかったときにエラー メッセージを表示します=IF(ISERROR=FALSE,ErrorMsg,...)。問題を解決するには、次の式を使用するだけです。
    =IF(ChildName="","データが入力されていません",IFERROR(VLOOKUP(ChildName,Children,6,0),"Cannot find "&ChildName))

ああ、なるほど!この質問を確認してください - Have Excel formulas that return 0, make the result blank . それはすべての方法を示しています。

私のお気に入りは=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 に答える