Copy formula's down a column

ExcelNoob11

New Member
Joined
Jul 17, 2018
Messages
7
I have a table with 10 columns that I need to insert formulas into to the last 5 columns to return values from a lookup table.

My formula works for the first 3 columns but the last 2 for some reason the RC goes haywire and points to some wild cells.

Column 6= =IFERROR(VLOOKUP(A9,Table1,2,FALSE),"")
Column 7= =IFERROR(VLOOKUP(A9,Table1,3,FALSE),"")
Column 8= =IFERROR(VLOOKUP(A9,Table1,4,FALSE),"")
Column 9= =VLOOKUP(XFD9,Table1,5,FALSE) <-- That should Be A9 too, but instead it goes to XFD9?
Column 10= =VLOOKUP(#REF!,Table1,6,FALSE) <-- then column 10 doesn't know where to look.

Here's my code:
Code:
    LastCol = Cells(2, Columns.Count).End(xlToLeft).Column
    LastRow = Cells(Rows.Count, "A").End(xlUp).Row
 
    Range("F9").Select
    ActiveCell.FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-5],Table1,2,FALSE),"""")"
    Range("F9", Cells(LastRow, 9)).FormulaR1C1 = Range("F9").FormulaR1C1
    
    Range("G9").Select
    ActiveCell.FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-6],Table1,3,FALSE),"""")"
    Range("G9", Cells(LastRow, 9)).FormulaR1C1 = Range("G9").FormulaR1C1
    
    Range("H9").Select
    ActiveCell.FormulaR1C1 = "=IFERROR(VLOOKUP(RC[-7],Table1,4,FALSE),"""")"
    Range("H9", Cells(LastRow, 9)).FormulaR1C1 = Range("H9").FormulaR1C1
    
    Range("I9").Select
    ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-8],Table1,5,FALSE)"
    Range("I9", Cells(LastRow, 9)).FormulaR1C1 = Range("I9").FormulaR1C1
  
    Range("J9").Select
    ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-9],Table1,6,FALSE)"
    Range("J9", Cells(LastRow, 9)).FormulaR1C1 = Range("J9").FormulaR1C1
 

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)
Just a guess, but try replacing the last 2 sections with:
Range("I9").FormulaR1C1 = "=VLOOKUP(RC[-8],Table1,5,FALSE)"
Range("I9", Cells(LastRow, 9)).FormulaR1C1 = Range("I9").FormulaR1C1

Range("J9").FormulaR1C1 = "=VLOOKUP(RC[-9],Table1,6,FALSE)"
Range("J9", Cells(LastRow, 9)).FormulaR1C1 = Range("J9").FormulaR1C1

Oops no that doesnt work.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,210
Members
453,023
Latest member
alabaz

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