text reference to cell...

B

brinded

I have column of entries, each of which has a cell with text
consisting of a few letters, either 'DPA', 'DP', 'ST'

I'd like to make a formula where the text points to a value given in
another cell - a key as it were.

something like =IF(B1='DPA',$X$10)

since I can't get a formula to 'lookup' a key, is there an easier way
of doing this?

thanks
 
B

brinded

I should add, there are only four text codes, each representing a
whole number, so the lookup would be really simple:

DPA 10
DP 20
ST 32
DG 42
 
J

JE McGimpsey

brinded said:
I should add, there are only four text codes, each representing a
whole number, so the lookup would be really simple:

DPA 10
DP 20
ST 32
DG 42

If the lookup table above were in, say, Sheet2!A1:B4, then one way:

=VLOOKUP(B1,Sheet2!$A$1:$B$4,2,FALSE)

or, if B1 may contain something other than the four values:

=IF(ISNA(MATCH(B1,Sheet2!$A$1:$A$4,FALSE), "", VLOOKUP(B1,
Sheet2!$A$1:$B$4,2,FALSE))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top