View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.newusers
Hugh self taught Hugh self taught is offline
external usenet poster
 
Posts: 7
Default vLookup but choose either of 2 columns

Thanks Dave,

I need some shut eye now so will play with this more in the morning

Cheers
Hugh

"Dave Peterson" wrote:

=vlookup(b1,sheet2!a:e,if(a1="asdf",4,5),false)

Will look for a match between B1 of sheet2 column A.

If A1 = "asdf", then column 4 (D) will be returned. Otherwise, column 5 (E)
will be returned.

You can make that if statement as complex as you want as long as it results in a
number between 1 and the number of columns in that range (A:E in my example).

If the expression is really complex, you could use a bunch of helper cells and
then just point at the final helper cell:

=vlookup(b1,sheet2!a:e,Z99,false)
(z99 is that final helper cell)

Hugh self taught wrote:

Hi All,

I have a scenario where I want to lookup a value in column A but would like
to choose either column 4 or 5 from the resultant row in a drop down based on
other criteria I know. Is something like that possible? If so is it possible
to have a heading on each column to better identify which is which?

How would I attempt such a manouver?

Cheers
Hugh


--

Dave Peterson