IF 与 VLOOKUP 组合返回 #VALUE
我正在使用一个有 2 个工作表的 Excel 工作表。 表 1 包含第 1 列中的键和第 3 列中的答案/数据的所有数据。
有很多行,并且不断变化,因此可以免维护。
如果工作表 1 中的某一行具有空值,工作表 2 将显示“0”。 为了防止这种情况发生,我使用示例信息创建了以下公式。
表 1 从 A3 开始,到 A300 结束(答案在第 3 列,即 C) 表 1 中带有空单元格的记录为 A10
=IF(VLOOKUP(A10;'Sheet1'!$A$3:$C$300;3;TRUE);VLOOKUP(A10;'Sheet1'!$A$3:$C$300;3;TRUE);"")
因此,如果表 1 中第 3 列中的 A10 值 = TRUE,则获取该值并呈现该值,否则不显示任何内容。 然而,当我使用“是”更新 C10 中 Sheet1 中的单元格时,此操作完美无缺。 Sheet2 中的 VLOOKUP 将返回#VALUE。 一旦我用随机数值(例如 123456)更新 C10 中的值,Sheet2 将显示 123456。
一旦我删除 VLOOKUP 周围的 IF 语句,Sheet2 的值将变为 Yes(在我将 Sheet1 C10 更新回 Yes 后)。
有人知道 IF(VLOOKUP) 是否适用于文本?在我的情况下,它不会以某种方式,但对于数字来说就很好。
谨致问候, 工程师
I'm working with an Excel sheet that has 2 sheets.
Sheet 1 has all the data with the key in Column 1 and answer/data in Column 3.
There are a lot of rows and this is changing continuously, so one would make this maintenance free.
If a certain row in Sheet 1 has an empty value, sheet 2 will show a '0'.
To prevent this from happening, I created the following formula with example information.
Sheet 1 starts on A3 and ends on A300 (answers in column 3 aka C)
Record in sheet 1 with empty cell is A10
=IF(VLOOKUP(A10;'Sheet1'!$A$3:$C$300;3;TRUE);VLOOKUP(A10;'Sheet1'!$A$3:$C$300;3;TRUE);"")
So if value of A10 in Sheet 1 in Column 3 = TRUE, get that value and present it else show nothing.
This works flawlessly, however, when I update the cell in Sheet1 in C10, with Yes. The VLOOKUP in Sheet2 will return #VALUE.
Once I update the value in C10 with random numeric values such as 123456, Sheet2 will show 123456.
Once I remove the IF statement around VLOOKUP the value of Sheet2 will becomes Yes (after I updated Sheet1 C10 back to Yes).
Anyone know if IF(VLOOKUP) works on Text? In my situation it doesn't somehow, but with numbers its fine.
With kind regards,
Engineer
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要稍微更改一下逻辑:
A10
(可以通过多种不同方式完成,我选择了COUNTIFS
)。VLOOKUP
是否返回 0。You need to change the logic a bit:
A10
can be found on sheet 1 (can be done many different ways, I've chosenCOUNTIFS
).VLOOKUP
does not return 0.