INDEX, MATCH, MATCH issues with multiples

amatsu

New Member
Joined
Feb 2, 2018
Messages
1
I'm having some difficulty with an INDEX, MATCH, MATCH setup. I'm usually pretty good at figuring out how to make these things work after some tinkering but this one has me stumped. I have two Sheets laid out similar to the following.

NAMERecent ONRecent OFF
Item 1
Item 2
Item 3
Item 4

<tbody>
</tbody>








NAMEON/OFFItem 1Item 2Item 3Item 4
DATE<--Just a label
DATE1ONCODE1CODE2CODE3CODE4
DATE1OFFCODE3
DATE2OFFCODE1
DATE2ONCODE5CODE6
DATE3OFFCODE7
DATE3ONCODE8

<tbody>
</tbody>


In the first sheet, A1 is the name of the second sheet. It is a drop down list that contains the names of all the rest of the sheets in the workbook. All sheets will be set up the same as the second sheet listed here. What I'm trying to do is INDEX, MATCH, MATCH the most recent ON and OFF for each Item in the columns of the second sheet to the columns in the first sheet. As you can see initially, all Items should have an "ON" date and corresponding CODE#. As time progresses, each Item will retire the code number and be assigned a new one, the date will be various for all items.


I need the formula to be as dynamic as possible. More Items may be inserted or some deleted. I have a formula that kind of works. If for example, I have the code in the cells in column B in the first sheet, it returns results of the row above my most recent "ON" in sheet 2. If there is nothing in that cell, the result is 0, of all are marked "OFF" the formula returns N/A. I know it's not a good idea to try and MATCH a cell within it's own array (I'm assuming anyways) but I cannot think of a way to do this without having a bunch of reference cells elsewhere. Which I cannot get to work anyways. I'll provide examples of that if necessary.

=INDEX(INDIRECT("'"&$A$1&"'!C3:AB34"),MATCH(MAX(IF(<wbr style="font-family: arial, sans-serif; font-size: 12.800000190734863px;">INDIRECT("'"&$A$1&"'!$B$4:$B$<wbr style="font-family: arial, sans-serif; font-size: 12.800000190734863px;">8")="On",INDIRECT("'"&$A$1&"'!<wbr style="font-family: arial, sans-serif; font-size: 12.800000190734863px;">$A$4:$A$8"),0)),INDIRECT("'"&$<wbr style="font-family: arial, sans-serif; font-size: 12.800000190734863px;">A$1&"'!$A$4:$A$8"),0),MATCH($<wbr style="font-family: arial, sans-serif; font-size: 12.800000190734863px;">A3,INDIRECT("'"&$A$1&"'!C1:<wbr style="font-family: arial, sans-serif; font-size: 12.800000190734863px;">AB1"),0))

Thanks!

 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,216,101
Messages
6,128,838
Members
449,471
Latest member
lachbee

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