Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 7
Default vLookup but choose either of 2 columns

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
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 35,218
Default vLookup but choose either of 2 columns

=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
  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3,572
Default vLookup but choose either of 2 columns

Say datalist is A1 to E20, with column headers in A1 to E1.

Lookup value to fin is in G1,
and dropdown cell is F1, which contains column headers matching labels in A1
to E1:

=INDEX(A2:E20,MATCH(G1,A2:A20,0),MATCH(F1,A1:E1,0) )
--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

"Hugh self taught" wrote in
message ...
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



  #4   Report Post  
Posted to microsoft.public.excel.newusers
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to do a Vlookup and choose the corresponding Value with highes fats_71 Excel Worksheet Functions 3 January 6th 09 04:43 AM
Query Wizard - Choose Columns MichaelRobert Excel Worksheet Functions 3 November 12th 08 10:55 PM
I have two columns 1 & 0 and want to choose those cell with 1 by . Dr. saeed mohtasham nia New Users to Excel 10 August 1st 06 09:35 AM
Vlookup or choose or? Dean Excel Discussion (Misc queries) 1 January 12th 06 06:21 PM
VLOOKUP, INDEX, MATCH... What to choose Piloulondon Excel Worksheet Functions 3 August 20th 05 07:15 PM


All times are GMT +1. The time now is 03:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"