VBA with index + match with 2 criterion issue

teowchy

New Member
Joined
Feb 18, 2019
Messages
1
Hi all,

First time posting here, I using index match formula for my report, just curious when i I increase the criterion, the result isn't shown property that i need, and it become blank while the cell is empty too.

this is the code for single criterion, no problem :
Code:
Cells(Target.Row, 4) = Application.WorksheetFunction.Index(WB.Worksheets(strWorksheets).Range("$AA:$AA"), Application.WorksheetFunction.Match(Target.Value, WB.Worksheets(strWorksheets).Range("$AB:$AB"), 0))

when Target.Value got duplicate, the result will always show the 1st result, so i try to increase the 2nd criterion, below is my code

Code:
Cells(Target.Row, 4) = Application.WorksheetFunction.Index(WB.Worksheets(strWorksheets).Range("$B:$AB"), Application.WorksheetFunction.Match(Target.Value, WB.Worksheets(strWorksheets).Range("$Y:$Y"), 0) + Application.WorksheetFunction.Match(NowSO, WB.Worksheets(strWorksheets).Range("$B:$B"), 0), 26)

if i use + between 2 match function, the result will always show the last row with non empty cell, or use - then the result is always the 1st row, how do I improve my code, as i know doing the array in VBA is using another method, but i no idea to amended it, thank in advance.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,223,268
Messages
6,171,100
Members
452,379
Latest member
IainTru

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