VBA Index and Match with Formula Array, Ranges in R1C1 only?

dylon25

New Member
Joined
Oct 25, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi, any help here would be appreciated:

As you can see from the formula below, the parameters for the index/match formula are ranges taken from the "variable_1.csv" workbook.
The formula works fine at this point
Windows("book1").Activate
Range("C4").Select
Selection.FormulaArray = _
"=INDEX(variable_1.csv!R2C1:R3239C10,MATCH(1,(RC1=variable_1.csv!R2C2:R3239C2)*(RC2=variable_1.csv!R2C3:R3239C3)*(R3C=variable_1.csv!R2C5:R3239C5),0),MATCH(Input!R4C2,variable_1.csv!R1C1:R1C10,0))"

Instead of hardcoded ranges though, I want to save each range in a range variable or Named Range and then use those in the formula instead
for example
dim x as range
set x = variable_1.csv!$A$2:$J$3239
'

Selection.FormulaArray = _
"=INDEX(x,MATCH(1,(RC1=variable_1.csv!R2C2:R3239C2)*(RC2=variable_1.csv!R2C3:R3239C3)*(R3C=variable_1.csv!R2C5:R3239C5),0),MATCH(Input!R4C2,variable_1.csv!R1C1:R1C10,0))"



I replaced the first argument with x, and I would want to do the same thing for all the other ranges in the formula. However it doesn't work, it seems all ranges must be in R1C1 style. How can I convert the ranges to R1C1 so that they can be used in this formula.

Thanks
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
can you post an example of what the formula should be in a view of the ranges?
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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