Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default vlookup for different ranges

hi

i have different database in different sheets i.e sheet1, sheet2, sheet3,
sheet4, sheet5...............sheet10,

in sheet 11 i used vlookup formula, i wnat to use the vlokup range for all
the sheet, if the value is not find in sheet 1 than find in sheet 2 or in
sheet 3 or in sheet4 means upto sheet 10 .

vlookup is possible for all the above sheet, is it possible.

helps needs

regards




  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default vlookup for different ranges

You can do it with the custom function below. Call it like normal VLOOKUP
except the following:
1: Put Range indouble quotes
2: Don't use False/True (4th parameter). Function makes it FALSE which is
an exact match

=PAGEVLOOKUP(9,"A1:B4", 2)

Function PageVLOOKUP(lookup_value, _
table_array, col_index_num)

SheetArray = Array("Sheet1", "Sheet2", _
"Sheet3", "Sheet4", "Sheet5", "Sheet6", _
"Sheet7", "Sheet8", "Sheet9", "Sheet10")

On Error Resume Next

For Each shname In SheetArray

Set lookuprange = Sheets(shname). _
Range(table_array)


PageVLOOKUP = WorksheetFunction. _
VLookup(lookup_value, _
lookuprange, col_index_num, _
False)
If PageVLOOKUP < "" _
Then Exit Function
Next shname
PageVLOOKUP = "#N/A"
End Function

"hitesh" wrote:

hi

i have different database in different sheets i.e sheet1, sheet2, sheet3,
sheet4, sheet5...............sheet10,

in sheet 11 i used vlookup formula, i wnat to use the vlokup range for all
the sheet, if the value is not find in sheet 1 than find in sheet 2 or in
sheet 3 or in sheet4 means upto sheet 10 .

vlookup is possible for all the above sheet, is it possible.

helps needs

regards




  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default vlookup for different ranges

iam confussed. it is macro?


"Joel" wrote:

You can do it with the custom function below. Call it like normal VLOOKUP
except the following:
1: Put Range indouble quotes
2: Don't use False/True (4th parameter). Function makes it FALSE which is
an exact match

=PAGEVLOOKUP(9,"A1:B4", 2)

Function PageVLOOKUP(lookup_value, _
table_array, col_index_num)

SheetArray = Array("Sheet1", "Sheet2", _
"Sheet3", "Sheet4", "Sheet5", "Sheet6", _
"Sheet7", "Sheet8", "Sheet9", "Sheet10")

On Error Resume Next

For Each shname In SheetArray

Set lookuprange = Sheets(shname). _
Range(table_array)


PageVLOOKUP = WorksheetFunction. _
VLookup(lookup_value, _
lookuprange, col_index_num, _
False)
If PageVLOOKUP < "" _
Then Exit Function
Next shname
PageVLOOKUP = "#N/A"
End Function

"hitesh" wrote:

hi

i have different database in different sheets i.e sheet1, sheet2, sheet3,
sheet4, sheet5...............sheet10,

in sheet 11 i used vlookup formula, i wnat to use the vlokup range for all
the sheet, if the value is not find in sheet 1 than find in sheet 2 or in
sheet 3 or in sheet4 means upto sheet 10 .

vlookup is possible for all the above sheet, is it possible.

helps needs

regards




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default vlookup for different ranges

Yes it is a macro. It simply uses the same function as the worksheet
function but search more than one worksheet. there arre two type of Macro in
excel. Sub (subroutines) and Functions. Functions behave like all the
standard library Functions such a VLOOKUP(), SUM(), etc , but can be written
to perform just about anything you can imagine and more.

To add macro
1) go to Tools Menu - Macro - Visual Basic Editor
2) VBA menu Insert Module
3) Paste code below

Make sure security level is set to medium which will ask you if you want to
run macros when the workbokk is opened.
1) go to worksheet Tools Menu - Macro - Security.
2) Set level to Medium
3) You need to close workbook and re-open if you change the security level
before the macro will run


"hitesh" wrote:

iam confussed. it is macro?


"Joel" wrote:

You can do it with the custom function below. Call it like normal VLOOKUP
except the following:
1: Put Range indouble quotes
2: Don't use False/True (4th parameter). Function makes it FALSE which is
an exact match

=PAGEVLOOKUP(9,"A1:B4", 2)

Function PageVLOOKUP(lookup_value, _
table_array, col_index_num)

SheetArray = Array("Sheet1", "Sheet2", _
"Sheet3", "Sheet4", "Sheet5", "Sheet6", _
"Sheet7", "Sheet8", "Sheet9", "Sheet10")

On Error Resume Next

For Each shname In SheetArray

Set lookuprange = Sheets(shname). _
Range(table_array)


PageVLOOKUP = WorksheetFunction. _
VLookup(lookup_value, _
lookuprange, col_index_num, _
False)
If PageVLOOKUP < "" _
Then Exit Function
Next shname
PageVLOOKUP = "#N/A"
End Function

"hitesh" wrote:

hi

i have different database in different sheets i.e sheet1, sheet2, sheet3,
sheet4, sheet5...............sheet10,

in sheet 11 i used vlookup formula, i wnat to use the vlokup range for all
the sheet, if the value is not find in sheet 1 than find in sheet 2 or in
sheet 3 or in sheet4 means upto sheet 10 .

vlookup is possible for all the above sheet, is it possible.

helps needs

regards




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default vlookup for different ranges

dear
joel
i dont want to use macro.

"Joel" wrote:

Yes it is a macro. It simply uses the same function as the worksheet
function but search more than one worksheet. there arre two type of Macro in
excel. Sub (subroutines) and Functions. Functions behave like all the
standard library Functions such a VLOOKUP(), SUM(), etc , but can be written
to perform just about anything you can imagine and more.

To add macro
1) go to Tools Menu - Macro - Visual Basic Editor
2) VBA menu Insert Module
3) Paste code below

Make sure security level is set to medium which will ask you if you want to
run macros when the workbokk is opened.
1) go to worksheet Tools Menu - Macro - Security.
2) Set level to Medium
3) You need to close workbook and re-open if you change the security level
before the macro will run


"hitesh" wrote:

iam confussed. it is macro?


"Joel" wrote:

You can do it with the custom function below. Call it like normal VLOOKUP
except the following:
1: Put Range indouble quotes
2: Don't use False/True (4th parameter). Function makes it FALSE which is
an exact match

=PAGEVLOOKUP(9,"A1:B4", 2)

Function PageVLOOKUP(lookup_value, _
table_array, col_index_num)

SheetArray = Array("Sheet1", "Sheet2", _
"Sheet3", "Sheet4", "Sheet5", "Sheet6", _
"Sheet7", "Sheet8", "Sheet9", "Sheet10")

On Error Resume Next

For Each shname In SheetArray

Set lookuprange = Sheets(shname). _
Range(table_array)


PageVLOOKUP = WorksheetFunction. _
VLookup(lookup_value, _
lookuprange, col_index_num, _
False)
If PageVLOOKUP < "" _
Then Exit Function
Next shname
PageVLOOKUP = "#N/A"
End Function

"hitesh" wrote:

hi

i have different database in different sheets i.e sheet1, sheet2, sheet3,
sheet4, sheet5...............sheet10,

in sheet 11 i used vlookup formula, i wnat to use the vlokup range for all
the sheet, if the value is not find in sheet 1 than find in sheet 2 or in
sheet 3 or in sheet4 means upto sheet 10 .

vlookup is possible for all the above sheet, is it possible.

helps needs

regards




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
VLOOKUP & TWO DIFFERENT RANGES SSJ New Users to Excel 5 September 8th 07 01:12 PM
VLOOKUP & TWO DIFFERENT RANGES SSJ Excel Worksheet Functions 5 September 8th 07 01:12 PM
vlookup ranges steve alcock Links and Linking in Excel 3 May 3rd 05 02:57 PM
Vlookup with 2 ranges in one worksheet Eelco Wiertsema Excel Worksheet Functions 5 February 18th 05 07:57 PM
vlookup and named ranges Domenic Excel Worksheet Functions 0 November 16th 04 04:08 PM


All times are GMT +1. The time now is 01:13 PM.

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

About Us

"It's about Microsoft Excel"