简体   繁体   English

当单元格值中有一个句点时,VLOOKUP将返回#N / A

[英]VLOOKUP will return #N/A when there is a period in the cell value

I am writing a formula for excel to find a value when the cell A13 is changed then compare the value of A13 to the other worksheets in the workbook and then return the value it found. 我正在为excel写一个公式,以更改单元格A13时查找值,然后将A13的值与工作簿中的其他工作表进行比较,然后返回找到的值。 I am struggling to get this formula to work because for some reason when the cell has a period in it VLOOKUP returns "#N/A". 我正在努力使此公式起作用,因为由于某些原因,当单元格中包含句点时,VLOOKUP返回“#N / A”。 It sometimes works when I use TRUE and do an approximate match. 当我使用TRUE并进行近似匹配时,它有时会起作用。 Here is an Example of a value that returns #N/A when searching for an exact match: ABCD.8G74. 这是一个搜索精确匹配时返回#N / A的值的示例:ABCD.8G74。 I would like to use FALSE in vlookup to get an exact match. 我想在vlookup中使用FALSE以获得完全匹配。 Here is the formula: 公式如下:

=IF(VLOOKUP(A13,sheet2!G2:J5,1,FALSE)=A13,VLOOKUP(A13,sheet2!G2:J5,2,FALSE),IF(VLOOKUP(A13,sheet3!G2:J5,1,FALSE)=A13,VLOOKUP(A13,sheet3!G2:J5,2,FALSE),IF(VLOOKUP(A13,sheet4!G2:J5,1,FALSE)=A13,VLOOKUP(A13,sheet4!G2:J5,2,FALSE),"0")))

if you have any more questions let me know. 如果您还有其他问题,请告诉我。 Thanks for yalls help! 谢谢你们的帮助!

Exact match by definition means that it will look for the EXACT value in the lookup table. 根据定义,精确匹配意味着它将在查找表中查找EXACT值。 If that value doesn't exact in the table, it returns #N/A. 如果该值在表中不正确,则返回#N / A。 If the value you are entering in A13 has periods, while the value in table doesn't have periods, then you need to find a way to remove the periods before performing the vlookup. 如果您在A13中输入的值包含句点,而表中的值没有句点,那么您需要在执行vlookup之前找到一种删除句点的方法。

You can use the substitute function to do this and pass that as the lookup value: 您可以使用替代函数来执行此操作,并将其作为查找值传递:

=SUBSTITUTE(A13,".","")

The problem is when it does not find it on the first sheet it returns #N/A and trying to compare an error to a cell value will return the Error and short circuit the IF. 问题是当它在第一张纸上找不到它时,它返回#N/A并且尝试将错误与单元格值进行比较将返回错误并使IF短路。

Wrap your VLOOKUPS in IFERROR: 在IFERROR中包装您的VLOOKUPS:

=IFERROR(VLOOKUP(A13,sheet2!G2:J5,2,FALSE),IFERROR(VLOOKUP(A13,sheet3!G2:J5,2,FALSE),IFERROR(VLOOKUP(A13,sheet4!G2:J5,2,FALSE),0)))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM