vlookup with table_array constructed from mid formula

J

JulieD

Hi

i have a text string in cell A1 e.g.
ABCXYDEF
the XY bit will change.

What i want to do is lookup a value in a table that has a range name of XY
e.g. =VLOOKUP(5,mid(A1,4,2),2,0)
but this doesn't seem to work.

how can i do this?

Cheers
JulieD
 
P

Peo Sjoblom

Where's the table?

This works

=VLOOKUP(MID(A1,4,2),C1:D14,2,0)




--
Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)
 
J

JulieD

Hi Peo

the table is range that has been named XY (literally in cells A17:H25)

Cheers
JulieD
 
P

Peo Sjoblom

Doh!

--
Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)
 
J

JulieD

Hi Biff

now why didn't that work the first 3 times i tried it before posting!!!!
.... thanks, it works now

Cheers
JulieD
 
J

JulieD

Hi guys

figured out the reason why my formulas weren't working

any ideas if (and how) the following is possible with VLOOKUP (or another
function)
i have a workbook with column A containing State Names (e.g. WA,SA,NT)
column B through D is one freight company with different weight ranges
columns E through G is another freight company
column H through J is another

my idea was to use range names to create tables with column A and in the
first instance B through D (named XX)
then XY was a range consisting of column A and E through G
then YY was a range consisting of columns A and H through J
(all were rows 17 to 25)
so that i could do a vlookup on the state, in the appropriate table and
return the freight cost for a certain weighted item

(hope you're now not totally confused)
however VLOOKUP doesn't seem to like working with tables that aren't a
continual range - any ideas or do i need to restructure the tables?

(i then still need to use the INDIRECT(MID()) within this VLOOKUP)

Cheers
JulieD
 
P

Peo Sjoblom

You rename the parts of the table, XX = B:D, XY = E:G and YY = H:J then the
whole table for instance ABCD

=VLOOKUP(5,ABCD,2+VLOOKUP(MID(A1,4,2),{"XX",0;"XY",3;"YY",6},2,0),0)

so if you put 2 and use XX it gets the value from column B, but if it is XY
it returns the value from column E and YY from
column H

--
Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)
 

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