Dynamic Array Formula to include a cell formula in output

New Contributor

I have a basic dynamic array formula that uses various functions to calculate results. However one of the outputs needs to actually be a cell formula. Is this possible?

I have shown below a simplified version of what I am trying to achieve, but doesn't work.

 

Dim outputs(4)

 

outputs(0) = 1
outputs(1) = 2
outputs(2).Formula = "=IF(R8<>"",((E8/1000)/T8)/(PI()*((LEFT(R8,3)/2000)^2)),0)"
outputs(4) = 4

 

PBD_Output = outputs

1 Reply

@AndyD21 

The elements of outputs are variants, you cannot set their Formula property.

And you must double quotes within a quoted string.

    Dim outputs(4)
    outputs(0) = 1
    outputs(1) = 2
    outputs(2) = "=IF(R8<>"""",((E8/1000)/T8)/(PI()*((LEFT(R8,3)/2000)^2)),0)"
    outputs(4) = 4
    PBD_Output.Value = outputs