Convert Index Match to VBA to Reference a Matrix

Domithious

New Member
Joined
Feb 22, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hello I'm trying to convert a Excel formula to VBA using Index and Match.

The formula i have is
=IFNA(INDEX('Sheet2'!$I$4:$M$8,MATCH([@[Height]],'Sheet2'!$H$4:$H$8,0),MATCH([@[Weight]],'Sheet2'!$I$3:$M$3,0)),"")

I have a Matrix in 'Sheet2' worksheet. In 'Sheet1' I have a table with Height and Weight columns and I'm trying to find the corresponding Matrix result for a third column.

I tried to record a Marco, but that doesn't really provide what i need as more and more rows will be added to the table.

Any advice would be much appreciated.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi!

It's not too difficult to port worksheet formulas into VBA because you can use Application.WorksheetFunction to directly call the worksheet functions in code, e.g. Application.WorksheetFunction.Match(...). It also looks like you're dealing with excel tables, so you might refer to this to help you with the syntax for (properly) dealing with tables.
 
Upvote 0

Forum statistics

Threads
1,215,268
Messages
6,123,965
Members
449,137
Latest member
yeti1016

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