View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Functions expert...numbering random condition in a column

=COUNTIF($A$2:A2,A2)&IF(OR(VALUE(RIGHT(COUNTIF($A$ 2:A2,A2),2))={11,12,13}),"th",IF(OR(VALUE(COUNTIF( $A$2:A2,A2))={1,2,3}),CHOOSE(RIGHT(COUNTIF($A$2:A2 ,A2)),"st
","nd ","rd "),"th "))&A2

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"JVANWORTH" wrote in message
...
I need to number random conditions as they occur in a column. The example
show is in its simplest form.

Column A is a list of colors that are selected randomly. Column B needs
to
be the order in which the color was selected relative to equivalent
colors.
So the first "red" selected will be "Red-1, next "red" selected will be
"Red-2". This will happen to for each color. i.e.....

A B
1 red 1 1st red
2 blue 1 1st blue
3 red 2 2nd red
4 red 3 3rd red
5 white 1 1st white
6 blue 2 2nd blue

When the order changes I want the spread to adjust accordingly.