IF with INDEX & MATCH

devo1234

New Member
Joined
Jun 18, 2018
Messages
9
Hi,

I need to tell my formula to search for one specific value in two different tabs. I currently wrote this (and it's working):

=INDEX(' table (2)'!I2:S727,MATCH('TEST'!P3&'TEST'!Q3,'table (2)'!G2:G727&'table (2)'!H2:H727,0),MATCH('TEST'!R3,'table (2)'!I1:S1,0))

I have two conditions: BLUE and RED.

The above formula is searching for a specific value using BLUE as condition in table (2). I then added:

=IF(N14="BLUE",INDEX(' table (2)'!I2:S727,MATCH('TEST'!P3&'TEST'!Q3,'table (2)'!G2:G727&'table (2)'!H2:H727,0),MATCH('TEST'!R3,'table (2)'!I1:S1,0)))

Works fine.

I would like to make the formula knows that if I want the colour BLUE then search table (2), if I want red then search table (1).

My current spreadsheet has 3 tabs:
TEST = where my workings are
table (1) where RED data is
table (2) where BLUE data is

Thanks for your help
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Welcome to the forum.

I think you mean:

=IF(N14="RED",INDEX(' table (1)'!I2:S727,MATCH('TEST'!P3&'TEST'!Q3,'table (1)'!G2:G727&'table (1)'!H2:H727,0),MATCH('TEST'!R3,'table (1)'!I1:S1,0)),IF(N14="BLUE",INDEX(' table (2)'!I2:S727,MATCH('TEST'!P3&'TEST'!Q3,'table (2)'!G2:G727&'table (2)'!H2:H727,0),MATCH('TEST'!R3,'table (2)'!I1:S1,0))))
 
Upvote 0

Forum statistics

Threads
1,223,895
Messages
6,175,257
Members
452,625
Latest member
saadat28

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