Unable to set the FormulaArray property of the Range Class

Nickp2

New Member
Joined
Oct 26, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm trying to use a FormulaArray and after splitting the formula I'm still getting the same runtime error "1004: Unable to set the FormulaArray property of the Range Class". I used the code from Entering Long Array Formulas in VBA – Daily Dose of Excel for testing which worked but then when putting in my own formula I get the error. Any help would be appreciated.

Nick
 

Attachments

  • FormulaArray.PNG
    FormulaArray.PNG
    144.3 KB · Views: 13

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
theFormulaPart1 = "=INT(IF(BM4="""","""",(BM4/VLOOKUP(H4&C4,S!$I$2:$O$9999,7,0))*" & _
"VLOOKUP(H4&C4,S!$I$2:$Q$9999,6,0)))+"

theFormulaPart2 = "X_X_X())" & _
"LOOKUP(MOD(IF(BM4="""","""",(BM4/VLOOKUP(H4&C4,S!$I$2:$O$9999,7,0))*" & _
"VLOOKUP(H4&C4,S!$I$2:$Q$9999,6,0)),1),{0,0.3,0.5,0.8},{0.29,0.49,0.79,0.99})"

With ActiveSheet.Range("A2:A7")
.FormulaArray = theFormulaPart2
.Replace "X_X_X())", theFormulaPart1
'.NumberFormat = "mmm dd"
End With
 
Upvote 0
Solution
theFormulaPart1 = "=INT(IF(BM4="""","""",(BM4/VLOOKUP(H4&C4,S!$I$2:$O$9999,7,0))*" & _
"VLOOKUP(H4&C4,S!$I$2:$Q$9999,6,0)))+"

theFormulaPart2 = "X_X_X())" & _
"LOOKUP(MOD(IF(BM4="""","""",(BM4/VLOOKUP(H4&C4,S!$I$2:$O$9999,7,0))*" & _
"VLOOKUP(H4&C4,S!$I$2:$Q$9999,6,0)),1),{0,0.3,0.5,0.8},{0.29,0.49,0.79,0.99})"

With ActiveSheet.Range("A2:A7")
.FormulaArray = theFormulaPart2
.Replace "X_X_X())", theFormulaPart1
'.NumberFormat = "mmm dd"
End With
My guess is that because theres no array in the first portion it gives the error. Adding the replace variable to the beginning of the second portion and then replacing it with the first portion worked. n case someone else gets stuck in a similar situation
 
Upvote 0

Forum statistics

Threads
1,213,529
Messages
6,114,155
Members
448,554
Latest member
Gleisner2

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