VBA Help - FormulaR1C1 Reference Not working

Johnny Thunder

Well-known Member
Joined
Apr 9, 2010
Messages
693
Office Version
  1. 2016
Platform
  1. MacOS
Hello all,

I have a code that creates an array SUMPRODUCT formula and for whatever reason the R1C1 part of the formula is the only thing not working. I am sure I am doing something weird but hopefully someone can spot the mistake and provide a revision.

Here is the line of code:

Code:
sF1 = "=IFERROR(SumProduct(ISNUMBER(MATCH(cData,{" & arr1 & "},0)) * (ISNUMBER(MATCH(GData,{" & arr2 & "},0)) * (Hdata= R7C & "" "" & RC5 ) *  DataTable) / & AmtRep & ,0)"
    Cell.Offset(0, x).FormulaR1C1 = sF1 'Drops formula into cell on Summary"

When I send the line to Debug.Print in the immediate Window, this is what I get, "=IFERROR(SumProduct(ISNUMBER(MATCH(cData,{1256,1261,1265,1811,3702},0)) * (ISNUMBER(MATCH(GData,{7840000,6080000},0)) * (Hdata= R7C & " " & RC5) * DataTable) /1,0)"

So everything seems to be coming incorrectly except for the R1C1 Reference: "Hdata= R7C & " " & RC5"

Any ideas what I am doing wrong?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
NEVERMIND! Answered my own question! I had an extra "(" in the code. I had the extra in front of the second ISNUMBER text.

Revised Line: sF1 = "=IFERROR(SumProduct(ISNUMBER(MATCH(cData,{" & arr1 & "},0)) * ISNUMBER(MATCH(GData,{" & arr2 & "},0)) * (Hdata= R7C & "" "" & RC5 ) * DataTable) / & AmtRep & ,0)"
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,547
Members
449,089
Latest member
davidcom

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