dear xld and hui
many thanks for the suggessions.i wanted to use less of vba and formulae to count colours.
i experimented with excel and found that if we assign values 1,2, and 3 to red,green and blue
we can use conditional formating (excel 2003,2007,2010) to colour the cells bearing 1,2,3...