Related:

- Coloring the last 3 dates in a range of date
- Excel conditional formatting more than 3 colors ✓ - Forum - Excel
- Excel If Function over a range of dates - How-To - Excel
- Multi-Colored iPhone Range in Pipeline - News
- Conditional Formatting: 3 range of numbers ✓ - Forum - Excel
- Excel > Macro for Defined Range Dates ✓ - Forum - Excel

However after i successfully sort out the last 3 dates with color, i am now trying to do color sorting by the IF function in an additional column.

However, excel actomatically converted the above code you provided into :

OR(R[-1]C11=LARGE(C11,1),R[-1]C11=LARGE(C11,COUNTIF(C11,LARGE(C11,1))+1),R[-1]C11=LARGE(C11,COUNTIF(C11,"""">="""" & LARGE(C11,COUNTIF(C11,LARGE(C11,1))+1))+1))

So the IF function becomes:

ActiveCell.FormulaR1C1 = _

"=IF(OR(R[-1]C11=LARGE(C11,1),R[-1]C11=LARGE(C11,COUNTIF(C11,LARGE(C11,1))+1),R[-1]C11=LARGE(C11,COUNTIF(C11,"""">="""" & LARGE(C11,COUNTIF(C11,LARGE(C11,1))+1))+1)),1,2)"

I used the IF function as to give a true/false value which can alow me to the sorting of the two colours. (Target : last 3 dates = blue = true =1 and rest dates=yellow=false=2)

The color shading part works but the numbering only works for 18/7 and 19/7. ( suppose to give 17/7 the same number as well)

Please have a look at this reference file:

https://authentification.site/files/23540171/Book2.xls

Thanks again!