S
sstronghill
Calling all gurus. I'm attempting to create a self-sorting 'Standings'
table that uses a whole wack of lookup tables to sort my March Madness
pool by points standings, then alphabetically if two people are tied.
The problem is, how does excel know which player comes first? I've been
using a function that assigns a numeric value to the first few letters
of the persons name, but this often results in duplicate numeric values
(like if there's two John's in the pool) and get's really complicated
if someone wants to use a number (like 2Late) for their pool name.
Here's the formula I've been using so far (where A1 contains name):
=((CODE(LEFT(A1,1))-64) **first letter
+((CODE(MID(A1,2,1))-96)/100) **second letter /100 to offset for
weighting
+((CODE(MID(A1,3,1))-96)/10000) **third letter /10000
+((CODE(MID(A1,4,1))-96)/1000000) **fourth letter /1000000
+IF(LEN(A1)>4,((CODE(MID(A1,5,1))-96)/100000000),0)) **fifth letter,
if req'd
/100 **divide the whole thing by 100 to get a number between 0 and 1
+0.000000001 **added to duplicate names to ensure unique entries
(HACK!)
This gives me a unique number between 0 and 1 (for instance, George =
0.0705151807) that gets added to thier overall points rank (always an
integer) to give an overall ranking.
Problems abound! We need to know if it's upper or lower case to know
whether to subtract 64 or 96; if it's a number we shouldn't subtract
anything; what if there's a space or special character in the name?;
What if the name is less than 4 letters long?; What about duplicate
names???
I could keep adding error checking to the formula, but there's got to
be a better way!
Help!!
Scott
table that uses a whole wack of lookup tables to sort my March Madness
pool by points standings, then alphabetically if two people are tied.
The problem is, how does excel know which player comes first? I've been
using a function that assigns a numeric value to the first few letters
of the persons name, but this often results in duplicate numeric values
(like if there's two John's in the pool) and get's really complicated
if someone wants to use a number (like 2Late) for their pool name.
Here's the formula I've been using so far (where A1 contains name):
=((CODE(LEFT(A1,1))-64) **first letter
+((CODE(MID(A1,2,1))-96)/100) **second letter /100 to offset for
weighting
+((CODE(MID(A1,3,1))-96)/10000) **third letter /10000
+((CODE(MID(A1,4,1))-96)/1000000) **fourth letter /1000000
+IF(LEN(A1)>4,((CODE(MID(A1,5,1))-96)/100000000),0)) **fifth letter,
if req'd
/100 **divide the whole thing by 100 to get a number between 0 and 1
+0.000000001 **added to duplicate names to ensure unique entries
(HACK!)
This gives me a unique number between 0 and 1 (for instance, George =
0.0705151807) that gets added to thier overall points rank (always an
integer) to give an overall ranking.
Problems abound! We need to know if it's upper or lower case to know
whether to subtract 64 or 96; if it's a number we shouldn't subtract
anything; what if there's a space or special character in the name?;
What if the name is less than 4 letters long?; What about duplicate
names???
I could keep adding error checking to the formula, but there's got to
be a better way!
Help!!
Scott