简体   繁体   English

索引匹配与间接和部分匹配?

[英]Index Match with Indirect and partial match?

I have a Ztable that I want to use as a lookup in a formula based on whatever Zscore I get.我有一个 Ztable,我想根据我得到的任何 Zscore 将其用作公式中的查找。 I have a Z score of 0.84, and the way the table works is that the first column you look at 0.8 then go to column 0.04 as that is the second decimal of 0.84 (so they combine) and you get your lookup value.我的 Z 分数为 0.84,表格的工作方式是您查看的第一列是 0.8,然后是 go 到 0.04 列,因为这是 0.84 的第二个小数点(因此它们结合起来),您就会得到查找值。

I am trying to achieve this with an Index Match formula, though for some reason it refuses to work, even though all of the parts of the formula works fine separately: Example in Excel Online: https://1drv.ms/x/s?ArOlf1rKamjocy6zekCl8cG3lAc?e=6ZzuTc我正在尝试使用索引匹配公式来实现这一点,尽管由于某种原因它拒绝工作,即使公式的所有部分都可以单独工作:Excel Online 中的示例: https://1drv.ms/x/s ?ArOlf1rKamjocy6zekCl8cG3lAc?e=6ZzuTc

Whole formula:整个公式:

=1-
INDEX(
INDIRECT("Table1[0.0"&RIGHT(E2,1)&"]"),
MATCH(
LEFT(E2,(FIND(".",E2,1)+1)),
Table1[Z],0))

0.84 is placed in E2 0.84放在E2

Separately I get 0.8 from this formula:另外,我从这个公式中得到 0.8:

=LEFT(E2,(FIND(".",E2,1)+1))

..and I get a reference to column 0.04 with this formula: ..我用这个公式得到了对 0.04 列的引用:

=INDIRECT("Table1[0.0"&RIGHT(E2,1)&"]")

So why is the Index match formula failing?那么为什么索引匹配公式会失败? If I write the formula cleanly, I get 0.7995:如果我清楚地写出公式,我会得到 0.7995:

=INDEX(Table1[0.04],MATCH(0.8,Table1[Z],0))

You do not need INDIRECT .您不需要INDIRECT Try this formula:试试这个公式:

=INDEX(Table1[[0]:[0.09]],MATCH(ROUNDDOWN(E2,1),Table1[Z],0),MATCH(TEXT((E2-ROUNDDOWN(E2,1)),"0.00"),Table1[[#Headers],[0]:[0.09]],0))

Change second column header from 0 to 0.00 , otherwise the value with one decimal place will not be found.将第二列 header 从0更改为0.00 ,否则将找不到小数点后一位的值。

在此处输入图像描述

The short answer is that the values in the 'Z' column are numeric, so you need to convert the string LEFT(E2,(FIND(".",E2,1)+1)) to a number before doing the lookup:简短的回答是“Z”列中的值是数字,因此您需要在查找之前将字符串 LEFT(E2,(FIND(".",E2,1)+1)) 转换为数字:

=1-INDEX(INDIRECT("Table1[0.0"&RIGHT(E2,1)&"]"),MATCH(--LEFT(E2,(FIND(".",E2,1)+1)),Table1[Z],0))

but @basic is right, there may be a better way of doing this without using Indirect.但是@basic 是对的,可能有更好的方法可以在不使用间接的情况下做到这一点。

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

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