View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Joe User[_2_] Joe User[_2_] is offline
external usenet poster
 
Posts: 905
Default Spredsheet problem

PS....

I wrote:
INDEX({10,15,5,...23otherValues...}, CODE(A1)-CODE("A")+1)


Of course, CODE(A1)-CODE("A")+1 could be replaced by CODE(A1)-64.

I just wanted to make the derivation of 64 clear.


----- original message -----

"Joe User" wrote:

"wildlife guy" <wildlife wrote:
I need to give a numeric value to letters in individual cells.
ex. A=10 B=15 c=5. Do I need to build a chart to reference?
I am in need of big help, a magic formula.
Justin


As usual, there are many ways to do this.

First, note that a letter already has a numeric value, e.g. CODE("A").

So, if you only need to handle uppercase characters, you could write:

INDEX({10,15,5,...23otherValues...}, CODE(A1)-CODE("A")+1)

Alternatively, you could put the 26 values in, say, X1:X26, and write:

INDEX($X$1:$X$26, CODE(A1)-CODE("A")+1)

If you need to handle lowercase as well, then write:

INDEX($X$1:$X$26, CODE(UPPERCASE(A1))-CODE("A")+1)