Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 390
Default Complicated lookup

I have several worksheets containing similar (but not identical, as some
tables have more rows than others) tables of data. These worksheets are named
for different vehicle types (petrol, diesel, petrol SUV, diesel SUV etc.).
Each table contains information pertaining to different vehicle types, with
the first row listing various engine sizes (2000, 2500 etc.).
As part of a larger operation, I want users to select a vehicle-type from a
drop-down list on my main 'search' page and also enter their engine size. The
selected values will determine on which worksheet a lookup function performs
and for which row of that particular table the function will 'look'. The
function will then return the value in the relative column.

E.G.
A user selects 'petrol SUV' from the drop-down list and enters '2700' as
their vehicle's engine size. A vlookup function then looks at the table on
the worksheet 'petrol_SUV' and returns a value from the required column in
the same row as '3000' (next size up from the size the user entered).

I had tried using INDIRECT with VLOOKUP to get to the correct sheet but then
I'm stuck with accessing the correct row (which is determined by engine
size), from which to offset to the required column.

Another post provided part of the answer, which I thought I could combine,
but now I'm stuck again.Any help greatly appreciated.

Additionally, I'm unsure how to select the various possible tables (on each
worksheet) as they have the same structure, but differing numbers of rows
(petrol vehicles have more engine types than diesel vehicles).

Hope this makes sense and thanks in advance for any assistance.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 208
Default Complicated lookup

You can use the vlookup / indirect functions to accomplish this.


try this formula -
=VLOOKUP(B3,INDIRECT(B2&"!$A:$C"),2,0)
assumes B2has the tab name you want to search under (i..e petrol,
diesel, etc.)
assumes B3 has the engine size

This also assumes that the various tabs are set up as follows:
Col A engine size (heading in row 1)
Col B Some attribute of engine i.e. fuel efficiency (heading in row 1)
Col C another engine attribute (heading in row 1)

=VLOOKUP($B$3,INDIRECT($B$2&"!$A:$c"),MATCH(C$6,IN DIRECT($B$2&"!
$1:$1"),0),0)

You could also use the formula above to dynamically tell the lookup
what column to return from the table

in the above example, it assumes that C6 has the name of the column
you want to retrieve from the various tabs.

On Jun 12, 6:50 am, Bill wrote:
I have several worksheets containing similar (but not identical, as some
tables have more rows than others) tables of data. These worksheets are named
for different vehicle types (petrol, diesel, petrol SUV, diesel SUV etc.).
Each table contains information pertaining to different vehicle types, with
the first row listing various engine sizes (2000, 2500 etc.).
As part of a larger operation, I want users to select a vehicle-type from a
drop-down list on my main 'search' page and also enter their engine size. The
selected values will determine on which worksheet a lookup function performs
and for which row of that particular table the function will 'look'. The
function will then return the value in the relative column.

E.G.
A user selects 'petrol SUV' from the drop-down list and enters '2700' as
their vehicle's engine size. A vlookup function then looks at the table on
the worksheet 'petrol_SUV' and returns a value from the required column in
the same row as '3000' (next size up from the size the user entered).

I had tried using INDIRECT with VLOOKUP to get to the correct sheet but then
I'm stuck with accessing the correct row (which is determined by engine
size), from which to offset to the required column.

Another post provided part of the answer, which I thought I could combine,
but now I'm stuck again.Any help greatly appreciated.

Additionally, I'm unsure how to select the various possible tables (on each
worksheet) as they have the same structure, but differing numbers of rows
(petrol vehicles have more engine types than diesel vehicles).

Hope this makes sense and thanks in advance for any assistance.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 390
Default Complicated lookup

Tim, many thanks for your reply. This almost works as needed. However, I need
the formula to look at the next HIGHER engine size. At present it looks at
the next LOWEST, in the event there is no exact match. The reason is that
essentially my engine size column should read "up to 2000", "2001 - 2500",
"2501 - 3000" etc. but I've simplified this by only including the maximum
size.

In a previous post I asked only about this functionality and got a great
reply using INDEX and "+1" to increment the column number. Unfotunately I
have been unable to incorporate that into your formula.

Any further ideas?


"Tim879" wrote:

You can use the vlookup / indirect functions to accomplish this.


try this formula -
=VLOOKUP(B3,INDIRECT(B2&"!$A:$C"),2,0)
assumes B2has the tab name you want to search under (i..e petrol,
diesel, etc.)
assumes B3 has the engine size

This also assumes that the various tabs are set up as follows:
Col A engine size (heading in row 1)
Col B Some attribute of engine i.e. fuel efficiency (heading in row 1)
Col C another engine attribute (heading in row 1)

=VLOOKUP($B$3,INDIRECT($B$2&"!$A:$c"),MATCH(C$6,IN DIRECT($B$2&"!
$1:$1"),0),0)

You could also use the formula above to dynamically tell the lookup
what column to return from the table

in the above example, it assumes that C6 has the name of the column
you want to retrieve from the various tabs.

On Jun 12, 6:50 am, Bill wrote:
I have several worksheets containing similar (but not identical, as some
tables have more rows than others) tables of data. These worksheets are named
for different vehicle types (petrol, diesel, petrol SUV, diesel SUV etc.).
Each table contains information pertaining to different vehicle types, with
the first row listing various engine sizes (2000, 2500 etc.).
As part of a larger operation, I want users to select a vehicle-type from a
drop-down list on my main 'search' page and also enter their engine size. The
selected values will determine on which worksheet a lookup function performs
and for which row of that particular table the function will 'look'. The
function will then return the value in the relative column.

E.G.
A user selects 'petrol SUV' from the drop-down list and enters '2700' as
their vehicle's engine size. A vlookup function then looks at the table on
the worksheet 'petrol_SUV' and returns a value from the required column in
the same row as '3000' (next size up from the size the user entered).

I had tried using INDIRECT with VLOOKUP to get to the correct sheet but then
I'm stuck with accessing the correct row (which is determined by engine
size), from which to offset to the required column.

Another post provided part of the answer, which I thought I could combine,
but now I'm stuck again.Any help greatly appreciated.

Additionally, I'm unsure how to select the various possible tables (on each
worksheet) as they have the same structure, but differing numbers of rows
(petrol vehicles have more engine types than diesel vehicles).

Hope this makes sense and thanks in advance for any assistance.



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
Lookup Help Complicated Gizmo Excel Discussion (Misc queries) 1 April 19th 08 05:53 PM
Complicated Lookup Function Latika Excel Worksheet Functions 3 July 6th 06 10:26 PM
Complicated value lookup TheFarmer42 Excel Discussion (Misc queries) 10 May 10th 06 05:05 PM
Complicated lookup/match fuction keysersoze Excel Worksheet Functions 0 September 14th 05 05:48 PM
Complicated lookup function chrisrowe_cr Excel Worksheet Functions 4 July 19th 05 05:52 PM


All times are GMT +1. The time now is 09:07 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"