Functions expert...numbering random condition in a column
Maybe this entered in B1 and copied down:
=IF(A1="","",COUNTIF(A$1:A1,A1))
This will return the count of each entry.
If you want the ordinal plus the color then it's more complicated:
=IF(A1="","",COUNTIF(A$1:A1,A1)&IF(OR(MOD(COUNTIF( A$1:A1,A1),100)={11,12,13}),"th",LOOKUP(--RIGHT(COUNTIF(A$1:A1,A1)),{0,"th";1,"st";2,"nd";3, "rd";4,"th"}))&"
"&A1)
Biff
"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.
|