ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Index Match function for lookup HELP (https://www.excelbanter.com/excel-worksheet-functions/447070-index-match-function-lookup-help.html)

Skye1973

Index Match function for lookup HELP
 
1 Attachment(s)
I have two worksheets where I am wanting to match data on tab 1 to data on tab two and return the intersecting value. I am using the formula below and keep returning the value of 0?

=IF(ISERROR(INDEX(Citrus!$A$1:$I$539,MATCH(A5,Citr us!$A$1:$H$296,0),MATCH($D$1,Citrus!$A$1:$Z$1,0))) ,0,INDEX(Citrus!$A$1:$I$539,MATCH(A5,Citrus!$A$1:$ A$296,0),MATCH($D$1,Citrus!$A$1:$Z$1,0)))

What am I doing wrong?

joeu2004[_2_]

Index Match function for lookup HELP
 
"Skye1973" wrote:
I have two worksheets where I am wanting to match data
on tab 1 to data on tab two and return the intersecting
value. I am using the formula below and keep returning
the value of 0?

=IF(ISERROR(INDEX(Citrus!$A$1:$I$539,MATCH(A5,Citr us!$A$1:$H$296,0),
MATCH($D$1,Citrus!$A$1:$Z$1,0))),0,INDEX(Citrus!$A $1:$I$539,
MATCH(A5,Citrus!$A$1:$A$296,0),MATCH($D$1,Citrus!$ A$1:$Z$1,0)))

What am I doing wrong?


For one thing, the range Citrus!$A$1:$H$296 in the ISERROR should be
Citrus!$A$1:$A$296, as it is in the value-if-true expression.


Spencer101

Quote:

Originally Posted by Skye1973 (Post 1605312)
I have two worksheets where I am wanting to match data on tab 1 to data on tab two and return the intersecting value. I am using the formula below and keep returning the value of 0?

=IF(ISERROR(INDEX(Citrus!$A$1:$I$539,MATCH(A5,Citr us!$A$1:$H$296,0),MATCH($D$1,Citrus!$A$1:$Z$1,0))) ,0,INDEX(Citrus!$A$1:$I$539,MATCH(A5,Citrus!$A$1:$ A$296,0),MATCH($D$1,Citrus!$A$1:$Z$1,0)))

What am I doing wrong?

Hi,

Try the below formula in cell F5 and copy down:

=INDEX(Citrus!$A$1:$G$56,MATCH($A5,Citrus!$A$1:$A$ 56,0),MATCH(D$1,Citrus!$A$1:$G$1,0))

Does that do what you need?

Skye1973

Quote:

Originally Posted by Spencer101 (Post 1605315)
Hi,

Try the below formula in cell F5 and copy down:

=INDEX(Citrus!$A$1:$G$56,MATCH($A5,Citrus!$A$1:$A$ 56,0),MATCH(D$1,Citrus!$A$1:$G$1,0))

Does that do what you need?

THANK YOU!!! This seems to do exactly what I need I just need to add the iserror portion. This is the first time I have gotten this index/match to work correctly.

Any thoughts based on my original formula where my logic is off?

Spencer101

Quote:

Originally Posted by Skye1973 (Post 1605317)
THANK YOU!!! This seems to do exactly what I need I just need to add the iserror portion. This is the first time I have gotten this index/match to work correctly.

Any thoughts based on my original formula where my logic is off?


Your original formula was looking at differing range sizes. So in the one instance you're looking at a range down to row 539 and then only down to 296. It's far easier to keep an eye on where these things could be going wrong if your range sizes match.

Also in the first MATCH you are looking at multiple columns where you should be looking at only one column.

Have a read of http://www.contextures.com/xlFunctions03.html . It gives lots of clear information on how to use INDEX & MATCH.

Having had a look again at your formula I an confused as to why you're using the IF(ISERROR approach. Are you just using this to produce a zero if no match is found?

I presume from the number of rows in your example workbook (1million+) that you're using Excel 2007 or later?
If this is the case then you can use =IFERROR() rather than an IF and ISERROR then doubling up the formula. So the formula in F5 and copied down would be:

=IFERROR(INDEX(Citrus!$A$1:$G$56,MATCH($A5,Citrus! $A$1:$A$56,0),MATCH(D$1,Citrus!$A$1:$G$1,0)),0)

Hope that helps. :)

Skye1973

Quote:

Originally Posted by Spencer101 (Post 1605324)
Have a read of http://www.contextures.com/xlFunctions03.html . It gives lots of clear information on how to use INDEX & MATCH.

I will be checking that out!

Quote:

Originally Posted by Spencer101 (Post 1605324)
Having had a look again at your formula I an confused as to why you're using the IF(ISERROR approach. Are you just using this to produce a zero if no match is found?

Yes the in the real workbook I will return several no match's that need to reflect a 0 vs an error.

Quote:

Originally Posted by Spencer101 (Post 1605324)
I presume from the number of rows in your example workbook (1million+) that you're using Excel 2007 or later?
If this is the case then you can use =IFERROR() rather than an IF and ISERROR then doubling up the formula. So the formula in F5 and copied down would be:

Yes we just upgraded from 2003 to 2010 and I am still getting used to the expanded functionality and new functions. Thanks for the tip on IFERROR the formula works perfectly!

Your post has been EXTREMLEY helpful in furthering my understanding of this combination of functions. Thanks so much!

Spencer101

Quote:

Originally Posted by Skye1973 (Post 1605327)
I will be checking that out!



Yes the in the real workbook I will return several no match's that need to reflect a 0 vs an error.



Yes we just upgraded from 2003 to 2010 and I am still getting used to the expanded functionality and new functions. Thanks for the tip on IFERROR the formula works perfectly!

Your post has been EXTREMLEY helpful in furthering my understanding of this combination of functions. Thanks so much!


Not a problem. Always happy to help. :)

joeu2004[_2_]

Index Match function for lookup HELP
 
"Skye1973" wrote:
Spencer101;1605315 Wrote:
Try the below formula in cell F5 and copy down:
=INDEX(Citrus!$A$1:$G$56,MATCH($A5,Citrus!$A$1:$A$ 56,0),
MATCH(D$1,Citrus!$A$1:$G$1,0))

[....]
Any thoughts based on my original formula where my logic is off?


I believe I answered that already. As I noted, you have a typo in the
ISERROR expression.

When I fix that, your original formula seems to work the same as Spencer's
rewrite without the loss of functionality (error detection).

Granted, you do not seem to need the error detection, at least with the
example Excel file. And granted, Spencer's rewrite simplifies your original
formula in ways that are consistent with the example Excel file.

But we cannot know if the example Excel file is representative of your total
and future needs. Only you can make that determination.



All times are GMT +1. The time now is 04:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com