For all cases you need some UDF that will get the colorindex of the text or
the cell.
To sort them, you would create a helper column with the colorindex returned
in, and sort by that column.
For the VLOOKUP, I think you will have problems. The index for the lookup
column is easy enough, it is the lookup table that is the problem, as any
colorindex function on that table will also return index for the offset
values, not the values themselves. So, although something like
=vlookup(COLORINDEX(B2),COLORINDEX(E2:F6),2,FALSE)
it will not work. You would need MATCH and INDEX, like
=INDEX(F2:F6,MATCH(colorindex(A2),colorindex(E2:E6),0))
As well as the page Frank referred you to, there is a colorindex routine at
http://xldynamic.com/source/xld.ColourCounter.html