What is this Index-match doing?

Richard U

Active Member
Joined
Feb 14, 2006
Messages
406
Office Version
  1. 365
  2. 2016
  3. 2010
  4. 2007
Platform
  1. Windows
I've stripped out all the path information and identifiable information.

This is referencing an external workbook, but I have never seen an index match written like this before.


Could someone please explain what this is doing?


Code:
=INDEX('[ExternalFile.xlsx]Consolidation'!$F:$F,MATCH(1,(A2='[ExternalFile.xlsx]Consolidation'!$B:$B)*(B2=[ExternalFile.xlsx]Consolidation'!$D:$D),0))
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Re: Help needed: What is this Index-match doing?

This part:

(A2='[ExternalFile.xlsx]Consolidation'!$B:$B)*(B2=[ExternalFile.xlsx]Consolidation'!$D:$D)

is multiplying two arrays of TRUE/FALSE results. To excel TRUE is 1 and FALSE is 0. So if you multiply TRUE x TRUE you get 1. Anything else produces 0. So if you use MATCH(1 you will get the position in the arrays where the two tests are TRUE. The INDEX then does its work.
 
Upvote 0
Re: Help needed: What is this Index-match doing?

Hi Richard U,

It's missing the curly brackets as it would need to be entered with Ctrl-Shift-Enter to work.

The INDEX is clear enough as it's getting a cell from column F of the external file..

The MATCH(1, is checking for a 1 to be returned from the next part of the check

If A2 is found in the external file in column B and on the same row B2 equals D then multiplying the logical 1 by 1 gives 1, so it finds a MATCH with MATCH(1, so returning the row number for the INDEX.

It has to be found on the same row otherwise (A2='[ExternalFile.xlsx]Consolidation'!$B:$B)*(B2=[ExternalFile.xlsx]Consolidation'!$D:$D) would give a (0*1), a (1*0) or a (0*0) all of which result in zero so no MATCH to 1.
 
Upvote 0
Re: Help needed: What is this Index-match doing?

Thanks, the curly brackets didn't copy over, and I didn't notice.
 
Upvote 0

Forum statistics

Threads
1,224,749
Messages
6,180,731
Members
452,995
Latest member
isldboy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top