Variables in Formula Array not returning the stored values

AmaChama

New Member
Joined
Sep 16, 2015
Messages
1
Hi everyone,

I've been working on a Formula Array code for the Index Sumproduct function to do a multi-criteria lookup. In the Formula Array code, RE, RA, i, RISKC, GENDER, FACE_BAND, PRODUCT, and IA are all variables. I've placed quotes around them accordingly and executed the code, but, for some reason, only the variables RE, RA, i, and IA return the correct value. The other variables return their name in text. I.e., the RISKC variable returns "RISKC", GENDER returns "GENDER."

I've printed the variables prior to running this portion of the code, and they all return the appropriate values. In the Formula Array code, they aren't.

Here is the part of the code I've been working on:

Code:
        If PRODUCT = "WL" Or PRODUCT = "UL" Then
            For i = 1 To 8
                For d = 10 * i - 9 To 10 * i
                    Sheets(RE & " Calculator").Cells(d + 1, 10).FormulaArray = "=INDEX(" & RE & "_Rates, SUMPRODUCT((" & RA & "_DUR = " & i & ")*(" & RA & "_RISKC =" & RISKC & ")*(" & RA & "_GNDR =" & GENDER & ")*(" & RA & "_FACE =" & FACE_BAND & ")*(" & RA & "_PROD =" & PRODUCT & ")*(ROW(" & RA & "_DUR) - 4)), " & IA & ")"
                Next d
            Next i
It returns this in Excel:
Code:
=INDEX(MUNICH_Rates, SUMPRODUCT((M_DUR = 1)*(M_RISKC = RISKC)*(M_GNDR = GENDER)*(M_FACE = FACE_BAND)*(M_PROD = Product)*(ROW(M_DUR) - 4)), 4)

Thanks so much in advance!
Amy
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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