Which conditional formatting you are talking about? Is it one which is applied through the conditional formatting rule or one which is applied by the code in the cells with the duplicate values.
Always attach the workbook in the question when you say it is not producing the desired output.