ActiveCell.FormulaR1C1 = "=IFERROR(IF(RC[-2]=""ES34C"",LEFT(RC[14],6),IF(COUNTIF(RC[14],""*MONNAYEUR*""),MID(RC[14],11,6),IF(LEN(RC[-1])=12,MID(RC[-1],7,4)&""4""&MID(RC[-1],12,1),IF(RC[-2]=""ES21C"",RIGHT(LEFT(RC[14],7),6),IF(RC[-2]=""ES38C"",MID(RC[-1],9,4)&""4""&MID(RC[-1],14,1),IF(RC[-2]=""ES23C"",MID(RC[14],1,4)&""4""&MID(RC[14],6,1),IF(RC[-2]=""TE01C"",RIGHT(RC[14],6),IF(RC[-2]=""ES34C"",LEFT(RC[14],6),IF(OR(RC[-2]=""ES44C"",RC[-2]=""ES38C"",RC[-2]=""ES45C""),RIGHT(LEFT(RC[14],12),6),IF(RC[-2]=""TE10C"",RIGHT(LEFT(RC[14],13),6),IF(LEFT(RC[14],1)=""S"",""NC"",LEFT(MID(RC[14],1,FIND("" "",RC[14],1)-1),6)))))))))))),""NC"")"
Cells(x, 4) = Cells(x, 4).Value