Reputation: 35
I am hoping to find a way to address this Formula parsing error
without have to manually change things each time I need to run the script.
I had hoped that Google Sheets - setFormulaR1C1(formula) doesn't seem to work would resolve my situation, but adding semi-colons fails to make a difference.
I am running a script which adds the following formula to cells in a column that has been added the sheet:
range.setFormulaR1C1('=VLOOKUP((INDIRECT("R[0]C[-28]";false)-INDIRECT("R[0]C[-29]";false));Moon!$B$19:$C$68;2;true)');`
It results in an ERROR#
with the message Formula parse error
.
However, clicking on formula in the entry field causes the correct expected value to appear above the formula on the left side of the edit box.
I can 'correct' the problem manually by adding an opening and a closing parenthesis to the formula. (I can also then delete those same parentheses and the formula still works with no parsing error.) I can then copy the formula down to the rows below and it works fine. If I attempt to copy the formula before adding (and deleting) the parentheses, it continues to fail.
Exhibits:
Upvotes: 2
Views: 847
Reputation: 38160
Since you are inserting a formula that use R1C1
notation as a text argument of INDIRECT and A1
notation as argument of another function, you should use setFormula
instead of setFormulaR1C1
.
Upvotes: 2