You may need to change the statementa s follows:
ActiveCell.FormulaR1C1 =
"=IF(AND(RC[-1]=R[1]C[-1],RC[-2]=R[1]C[-2]),""duplicate"","" "")"
If Active Cell is F4 and run this code, then VBA will output this formula:
=IF(AND(E4=E5,D4=D5),"duplicate"," ")