Jennifer
Jennifer

Reputation: 11

relative reference in an array

I have a spreadsheet with 48 columns, and as many rows as there are hours in a month. the formulas are intricate, but when you send them out into the world, people be peopling with your formulas. I want to have a good restore formulas macro, but it is inelegant.

the original formula created by PI is an array that has relative reference to another formula at the 5th row of each column.

Range("A8:AW8").FormulaArray = _ "=PIAdvCalcExpDat(R5C[1], R1C2, R2C2,""1h"",""average (time-weighted)"",""time-weighted"",""compressed"",""10m"",0,1,1,"""")"

I've highlighted in bold italic the reference that needs correcting. R5C[1] only returns column B across all columns, and i need it to reference B:AW relative to each column. so the formula in B8 references B5, the formula in C8 references C5.

also, column A is actually a timestamp, that's why it gets shifted over one column [1].

any help is much appreciated.

enter image description here i can just put in a formula for each column, but it slows the spreadsheet down considerably. and it's brutish.

i can also do this, but i lose my timestamp which is essential: Range("B8:AW8").Formula2R1C1 = _ ' "=PIAdvCalcExpDat(R5C,R1C2,R2C2,""1d"",""average (time-weighted)"",""time-weighted"",""compressed"",""10m"",0,1,0,"""")"

Upvotes: 1

Views: 29

Answers (0)

Related Questions