ArrayFormula as Value in VBA

mucah!t

Well-known Member
Joined
Jun 27, 2009
Messages
593
Hi all,

How do I get the following code to insert the result rather than the formula itself in a cell

Code:
Range("AH2").FormulaArray = "=SUM(IF(WERKBLAD!R[2]C[-30]:R[2]C[222]=RC[-2],IF(WERKBLAD!R[4]C[-32]:R[998]C[-32]>=RC[-4],IF(WERKBLAD!R[4]C[-32]:R[998]C[-32]<=RC[-3],IF(WERKBLAD!R[4]C[-30]:R[998]C[222]=""Z"",1)))))"
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
You could try:
Code:
With Range("AH2")
   .FormulaR1C1 = "=SUMPRODUCT(--(WERKBLAD!R[2]C[-30]:R[2]C[222]=RC[-2]),--(WERKBLAD!R[4]C[-32]:R[998]C[-32]>=RC[-4]),--(WERKBLAD!R[4]C[-32]:R[998]C[-32]<=RC[-3]),--(WERKBLAD!R[4]C[-30]:R[998]C[222]=""Z""))"
   .Value = .Value
End With
 
Upvote 0
I didn't look at your formula closely enough - the ranges are different shapes. Try this:
Code:
With Range("AH2")
   .FormulaR1C1 = "=SUMPRODUCT((WERKBLAD!R[2]C[-30]:R[2]C[222]=RC[-2])*(WERKBLAD!R[4]C[-32]:R[998]C[-32]>=RC[-4])*(WERKBLAD!R[4]C[-32]:R[998]C[-32]<=RC[-3])*(WERKBLAD!R[4]C[-30]:R[998]C[222]=""Z""))"
   .Value = .Value
End With
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,259
Members
452,901
Latest member
LisaGo

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