Sub col_j()
Dim x As String
x = Range("F2").Value
Range("J8:J59").FormulaR1C1 = _
"=IFERROR(IF(COUNTIF(OFFSET(INDIRECT(""'""&RC2&""'""&""!""&R6C5),0,0,IF(AND(VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C9,8,FALSE)>19,VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C9,8,FALSE)<500),0,IF(AND(IF(VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C4,3,FALSE)>0,IFERROR(20-VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R59C9,8,FALSE),0))<=RC[2],IF(VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C4,3,FALSE)>0,0,IFERROR(20-VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C9,8,FALSE),0))<>0),""Yes"",IF(VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C4,3,FALSE)>0,0,IFERROR(20-VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C9,8,FALSE),0)))),IF(AND(VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C9,8,FALSE)>19,VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C9,8,FALSE)<500),0,IF(AND(IF(VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C4,3,FALSE)>0,0,IFERR
this part is automatically put on the next line, and so the code is giving an error, it should be continuous next on the code above.
OR(20-VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C9,8,FALSE),0))<=RC[2],IF(VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C4,3,FALSE)>0,0,IFERROR(20-VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C9,8,FALSE),0))<>0),""Yes"",IF(VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C4,3,FALSE)>0,0,IFERROR(20-VLOOKUP(RC[-8],'[" & x & ".xlsm]Payroll_Computation '!R8C2:R59C9,8,FALSE),0))))),0)"
End Sub
Bookmarks