FormulaArray with variable

Konrado

New Member
Joined
Jun 17, 2014
Messages
34
Hi I have problem with formula array, I want to put variable inside, but excel shows fail. What can be the reason?
Below the code:

Sub PoprawkiView()


Dim lastrow As Long


lastrow = Sheets("DATA").Range("A" & Rows.Count).End(xlUp).Row


With Sheets("View")


.Range("E14").FormulaArray = "=SUM((R4C5=DATA!R4C4:R" & lastrow & "C4)*(IF(R5C5<>""TOTAL"",R5C5=DATA!R4C5:R2526C5,1))*(RC3=DATA!R4C14:R2526C14)*(RC4=DATA!R4C12:R2526C12)*(R11C=DATA!R2C19:R2C66)*(CHOOSE(R218C6,R218C8=DATA!R3C19:R3C66,R218C8>=DATA!R3C19:R3C66,R218C8<DATA!R3C19:R3C66))*(DATA!R4C19:R2526C66))"
.Range("E14").Copy .Range("F14:H14")
.Range("E14").Copy .Range("E15:H24,E26:H40,E42:H70,E72:H78,E80:H108,E110:H118,E120:H121,E123:H133,E135:H140")
.Range("E14").Copy .Range("E144:H145,E147:H148")

End With


End Sub
 
Ofcourse, :S But you said it worked already, it shouldnt when you insert the formula with ";"

Glad its solved tho :)
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi everybody, I wanted to add some code to formula (bolded below), but it fails again. How to add this part to code? Thanks in advance

=SUM(($E$4=DATA!$D$4:$D$2526)*(IF($E$5<>"TOTAL";$E$5=DATA!$E$4:$E$2526;1))*($C14=DATA!$N$4:$N$2526)*($D14=DATA!$L$4:$L$2526)*(E$11=DATA!$S$2:$BN$2)*(CHOOSE($F$218;$H$2 18=DATA!$S$3:$BN$3;$H$218>=DATA!$S$3:$BN$3;$H$218 < DATA!$S$3:$BN$3))*(DATA!$S$4:$BN$2526))



 
Upvote 0
Hi everybody, I wanted to add some code to formula (bolded below), but it fails again. How to add this part to code? Thanks in advance

=SUM(($E$4=DATA!$D$4:$D$2526)*(IF($E$5<>"TOTAL";$E$5=DATA!$E$4:$E$2526;1))*($C14=DATA!$N$4:$N$2526)*($D14=DATA!$L$4:$L$2526)*(E$11=DATA!$S$2:$BN$2)*(CHOOSE($F$218;$H$2 18=DATA!$S$3:$BN$3;$H$218>=DATA!$S$3:$BN$3;$H$218 < DATA!$S$3:$BN$3;$H$218))*(DATA!$S$4:$BN$2526))

I have forgotten much about this thread, but, $H$218 is missing after?
, just seems its missing symmetri-wise.
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

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