简体   繁体   中英

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. 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.

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

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

Separately I get 0.8 from this formula:

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

..and I get a reference to column 0.04 with this formula:

=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:

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

You do not need 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.

在此处输入图像描述

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:

=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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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