Index and match Multiple Criteria

Nuttawut Udom

New Member
Joined
Jul 27, 2024
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
How to use formula Below in Vba. I have tried many methods but still can't find the right answer.


"=INDEX('[Master Plan 91 20072024.xlsm]Master Plan'!$I:$I,MATCH(E3&P3,'[Master Plan 91 20072024.xlsm]Master Plan'!$H:$H&'[Master Plan 91 20072024.xlsm]Master Plan'!$AL:$AL,0))"


Thanks for all the answers
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Welcome to the MrExcel forum.

Have you tried:

VBA Code:
Range("A3").FormulaArray ="=INDEX('[Master Plan 91 20072024.xlsm]Master Plan'!$I:$I,MATCH(E3&P3,'[Master Plan 91 20072024.xlsm]Master Plan'!$H:$H&'[Master Plan 91 20072024.xlsm]Master Plan'!$AL:$AL,0))"

Also note that the formula will end up relative to the target range.
 
Upvote 0
This FormulaArray Stick to one line only, don't follow other lines. Range("A3").FormulaArray ="=INDEX('[Master Plan 91 20072024.xlsm]Master Plan'!$I:$I,MATCH(E3&P3,'[Master Plan 91 20072024.xlsm]Master Plan'!$H:$H&'[Master Plan 91 20072024.xlsm]Master Plan'!$AL:$AL,0))"
 
Upvote 0
I'm not sure what your question is. What exactly are you trying to achieve?

It's possible to assign the formula to a range if that's what you want. Like this:

Rich (BB code):
Range("A3:A10").FormulaArray ="=INDEX('[Master Plan 91 20072024.xlsm]Master Plan'!$I:$I,MATCH(E3&P3,'[Master Plan 91 20072024.xlsm]Master Plan'!$H:$H&'[Master Plan 91 20072024.xlsm]Master Plan'!$AL:$AL,0))"

As I said before the ranges will be relative, so that in the A3 cell E3&P3 will be E3&P3, in the A4 cell E3&P3 will become E4&P4, and so on. If you want something more complicated, you could put the statement in a loop, and manually create the formula string each time through, making the individual changes as needed.
 
Upvote 0

Forum statistics

Threads
1,221,527
Messages
6,160,342
Members
451,638
Latest member
MyFlower

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