Macro Recorder Formula Failed

rbrace

New Member
Joined
Apr 30, 2012
Messages
17
Code to insert formula is from macro recorder but it fails when run. I read several post on R1C1 but I am lost.

Code:
Range("AB36").Select    ActiveCell.FormulaR1C1 = _
        "=IF(R[18]C[5]<>"""",R[18]C[5],IFERROR(SUM(VLOOKUP(R2C16,DataQuery!R[-31]C[-27]:R[464]C[70],MATCH(""CCTVChangeOrder1"",DataQuery!R[-32]C[-27]:R[-32]C[70],0),FALSE),VLOOKUP(R2C16,DataQuery!R[-31]C[-27]:R[464]C[70],MATCH(""CCTVChangeOrder2"",DataQuery!R[-32]C[-27]:R[-32]C[70],0),FALSE),VLOOKUP(R2C16,DataQuery!R[-31]C[-27]:R[464]C[70],MATCH(""CCTVChangeOrder3"",DataQuer" & _
        "C[-27]:R[-32]C[70],0),FALSE), VLOOKUP(R2C16,DataQuery!R[-31]C[-27]:R[464]C[70],MATCH(""CCTVChangeOrder4"",DataQuery!R[-32]C[-27]:R[-32]C[70],0),FALSE), VLOOKUP(R2C16,DataQuery!R[-31]C[-27]:R[464]C[70],MATCH(""CCTVChangeOrder5"",DataQuery!R[-32]C[-27]:R[-32]C[70],0),FALSE)),""""))"

The formula I am trying to insert is:
Code:
=IF(AG54<>"",AG54,IFERROR(SUM(VLOOKUP($P$2,DataQuery!A5:CT500,MATCH("CCTVChangeOrder1",DataQuery!A4:CT4,0),FALSE),VLOOKUP($P$2,DataQuery!A5:CT500,MATCH("CCTVChangeOrder2",DataQuery!A4:CT4,0),FALSE),VLOOKUP($P$2,DataQuery!A5:CT500,MATCH("CCTVChangeOrder3",DataQuery!A4:CT4,0),FALSE), VLOOKUP($P$2,DataQuery!A5:CT500,MATCH("CCTVChangeOrder4",DataQuery!A4:CT4,0),FALSE), VLOOKUP($P$2,DataQuery!A5:CT500,MATCH("CCTVChangeOrder5",DataQuery!A4:CT4,0),FALSE)),""))
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Try this;

Code:
Range("AB36").Formula = "=IF(AG54<>"""",AG54,IFERROR(SUM(VLOOKUP($P$2,DataQuery!A5:CT500,MATCH(""CCTVChangeOrder1"",DataQuery!A4:CT4,0),FALSE),VLOOKUP($P$2,DataQuery!A5:CT500,MATCH(""CCTVChangeOrder2"",DataQuery!A4:CT4,0),FALSE),VLOOKUP($P$2,DataQuery!A5:CT500,MATCH(""CCTVChangeOrder3"",DataQuery!A4:CT4,0),FALSE), VLOOKUP($P$2,DataQuery!A5:CT500,MATCH(""CCTVChangeOrder4"",DataQuery!A4:CT4,0),FALSE), VLOOKUP($P$2,DataQuery!A5:CT500,MATCH(""CCTVChangeOrder5"",DataQuery!A4:CT4,0),FALSE)),""""))"
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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