View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre
 
Posts: n/a
Default Pulling a Letter from a cell and filling another cell with info

Not sure exactly where you are getting the associated number to append to the
"E", so maybe this will get you in the right direction:

This formula will return the ASCII code for the uppercase, 5th letter in
cell A1:
=CODE(UPPER(MID(A1,5,1)))

Here's what it return for various letters:
A....65
B....66
R....82
S....83
T....84
U....85
V....86

So if you meant the ASCII code, then this would work:
="E"&CODE(UPPER(MID(A1,5,1)))

BUT...
If you have some non-sequential numbers to assign to the letter, you might
try one of these:

This one assign whatever you want to the ASCII code:
="E"&CHOOSE(CODE(UPPER(MID(A1,5,1)))-64,100,105,18,23,12,109...etc to 26
value)
It subtracts 64 from the code, so A:1, B:2.....Z:26
Then, for each value from 1 to 26, you need to assign the number to return.
In my example, 1 returns 100, 2 returns 105....etc.

OR

You could construct a separate lookup table of letters with their
corresponding return value:

For lookup table in cells D1:E3
R............84
U............86
V............87
etc

and use: ="E"&VLOOKUP(MID(A1,5,1),D1:E3,2,0)


Does that give you something to work with?

***********
Regards,
Ron


"nick s" wrote:

I am a newbee at this so bare with me......

Here is what I am trying to do with no luck so far.
If I type RS23U1R109000 in a cell A1, I want B1 to read the 5th letter or
number and fill B1 with E86.

Example
A1= RS23U1R109000 B1=E86
A1= RS23V1R109000 B1=E87
A1= RS23R1R109000 B1=E84

As you can see in my example, the 5th letter could be U,V,R or whatever, but
I need cell B1 to read that letter and populate B1 with E86, E87, E84 or
whatever.

I hope I haven't confused anyone...