简体   繁体   English

VLookup的VLookup

[英]VLookup of a VLookup

All the single use VLOOKUP formulas work perfectly, but the formula below is a nested VLOOKUP and always fails. 所有一次性使用的VLOOKUP公式都可以正常工作,但是下面的公式是嵌套的VLOOKUP,并且始终会失败。

=VLOOKUP(VLOOKUP(V2,PRAISe,2,FALSE)-VLOOKUP(D2,PRAISe,2,FALSE),Progress,2,FALSE)

When I step thought the formula the nested VLOOKUPS work fine and resolve to the correct decimal value. 当我一步想到公式时,嵌套的VLOOKUPS可以正常工作并解析为正确的十进制值。 When the top level vlookup searches for that decimal value I always get a no value found error. 当顶级vlookup搜索该十进制值时,我总是会收到找不到值的错误。

The lookup ranges are as follows: 查找范围如下:

  PRAISE Lookup
    1-  1.20
    1+  1.80
    1=  1.50
    2-  2.20
    2+  2.80
    2=  2.50
    etc. etc.


   Grade Lookup
    1.20    1-
    1.50    1=
    1.80    1+
    2.20    2-
    2.50    2=
    2.80    2+
    etc. etc.

    Progress    
    0.00    0
    0.30    1
    0.60    2
    0.90    3
    1.20    4
    etc. etc.

Things I have tried. 我尝试过的东西。

At first I thought it was due to the decimal places and an exact match problem, so I multiplied all my results by 10, so I was only working with whole numbers. 起初,我认为这是由于小数位和完全匹配问题引起的,所以我将所有结果乘以10,所以我只处理整数。 Unfortunately I got the same result. 不幸的是我得到了相同的结果。

I have also tried spitting the formula across two columns. 我也尝试过将公式分散到两列中。 Again the subtraction works and resolves to a decimal number. 减法再次起作用并解析为十进制数。 However when I then try and look that number up as a separate statement it still fails. 但是,当我尝试将该数字作为一个单独的语句查找时,它仍然失败。

This may be due to the way that numbers are stored in Excel. 这可能是由于数字在Excel中的存储方式所致。 If you round the subtraction or use TRUE as the last argument in the outer lookup, the formulas seem to work. 如果四舍五入或在外部查找中使用TRUE作为最后一个参数,则该公式似乎有效。 I changed V2 to A2 for sake of the screenshot. 为了截图,我将V2更改为A2。

=VLOOKUP(ROUND(VLOOKUP(A2,Praise,2,FALSE)-VLOOKUP(D2,Praise,2,FALSE),1),Progress,2,FALSE) =VLOOKUP(VLOOKUP(A2,Praise,2,FALSE)-VLOOKUP(D2,Praise,2,FALSE),Progress,2,TRUE) = VLOOKUP(ROUND(VLOOKUP(A2,Praise,2,FALSE)-VLOOKUP(D2,Praise,2,FALSE),1),Progress,2,FALSE)= VLOOKUP(VLOOKUP(A2,Praise,2,FALSE)- VLOOKUP(D2,赞扬,2,FALSE),进展,2,TRUE)

在此处输入图片说明

But there are combinations where the subtraction of the VLookup does not have an exact match in the Progress table, for example 2+ returns 2.8 and 1- returns 1.2. 但是在某些组合中,VLookup的减法在Progress表中不完全匹配,例如2+返回2.8,1-返回1.2。 The subtraction result is 1.6 and a Vlookup with FALSE on the Progress table will return an error, while the vlookup with TRUE as the last parameter will return the next smallest match. 减法结果为1.6,进度表上带有FALSE的Vlookup将返回错误,而最后一个参数为TRUE的vlookup将返回下一个最小匹配项。

So check your V2 and D2 cells for combinations that are not found, and determine if you can get away with rounding or if you need to use TRUE in the outer lookup. 因此,请检查您的V2和D2单元是否有未找到的组合,并确定是否可以舍入,或者是否需要在外部查找中使用TRUE。

您是否在其中缺少括号以使公式清楚您想要的操作顺序?

=VLOOKUP((VLOOKUP(V2,PRAISe,2,FALSE))-(VLOOKUP(D2,PRAISe,2,FALSE)),Progress,2,FALSE)

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

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