Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
VDU VDU is offline
external usenet poster
 
Posts: 16
Default How can I use a sheet in a formula based on the value in a cell

I have a problem trying to make a formula that searches for a value in a
certain table but it chooses in what table based on the value in another
cell. Each table is in a separate sheet.

Basically I need a function to get the value in cell B2, search in the sheet
named exactly like the value in B2. The search is made in a matrix but is not
the problem, an easy index function with the row and column determined using
2 match functions. It's getting the functions to search in the right sheet,
making the arrays in the index function and the 2 match functions to depend
on the value in cell B2 that I found problematic.

Using a different aproach, I cam up with this:

INDIRECT("'"&B$2&"'!R"&(10+Match(B5, address(11, 2, 1, true,
B2):Address(65000, 2, 1, true), 0))&"C"&(2+Match(A5, address(2, 3, 1, true,
B2):Address(2, 200, 1, true, B2), 0)), false), FALSE)

But again it doesn't work, probably the address funtion is not used correctly.

If you can please help me with any of the 2 approaches or have a 3rd one
that works please do. One thing to mention, until now I used a macro to do
the same thing, I can't use it any more, it has to be with functions.

Thank you,
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default How can I use a sheet in a formula based on the value in a cell

It would help if there was a bit more detail. Are your tables in
exactly the same cells in all the sheets? I suggest you get the
formula working for just one sheet, so that it is something like:

=INDEX(Sheet1!table,MATCH(cell1,Sheet1!range1,0),M ATCH(cell2,Sheet1!
range2,0))

and then wherever you have Sheet1! you can replace this with:

INDIRECT("'"&B$2&"'!range_n")

Hope this helps.

Pete

On Nov 13, 7:02 pm, VDU wrote:
I have a problem trying to make a formula that searches for a value in a
certain table but it chooses in what table based on the value in another
cell. Each table is in a separate sheet.

Basically I need a function to get the value in cell B2, search in the sheet
named exactly like the value in B2. The search is made in a matrix but is not
the problem, an easy index function with the row and column determined using
2 match functions. It's getting the functions to search in the right sheet,
making the arrays in the index function and the 2 match functions to depend
on the value in cell B2 that I found problematic.

Using a different aproach, I cam up with this:

INDIRECT("'"&B$2&"'!R"&(10+Match(B5, address(11, 2, 1, true,
B2):Address(65000, 2, 1, true), 0))&"C"&(2+Match(A5, address(2, 3, 1, true,
B2):Address(2, 200, 1, true, B2), 0)), false), FALSE)

But again it doesn't work, probably the address funtion is not used correctly.

If you can please help me with any of the 2 approaches or have a 3rd one
that works please do. One thing to mention, until now I used a macro to do
the same thing, I can't use it any more, it has to be with functions.

Thank you,



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,180
Default How can I use a sheet in a formula based on the value in a cell

Pete_UK has the perfect solution.
Here is his formula with a few more details:
=INDEX(array1,
10+MATCH(RN,INDEX(INDIRECT("'"&Tab&"'!Array3"),2,) ,0),
2+MATCH(CN,INDEX(INDIRECT("'"&Tab&"'!Array3"),,2), 0))
Array1 is some table on Sheet1
Tab contains the text SH3
Array3 is some table on sheet SH3
RN contains the number you are searching for in row 2 of Array3
CN contains the number you are searching for in column 2 of Array3
10 is added to the row location of RN and becomes the row location for
Array1
2 is added to the column location of CN and becomes the column
location for Array1

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
Can a sheet be named automatically based off the value of a cell? ktun Excel Worksheet Functions 1 May 16th 07 09:19 PM
Formula Help - Copy data from one sheet to another based on criter aaghd Excel Worksheet Functions 5 December 27th 06 10:39 PM
Copy rows from one sheet to another based on a cell value SM1 New Users to Excel 1 December 21st 06 01:00 AM
Set color of cell based on info on another sheet? 43fan Excel Worksheet Functions 2 December 13th 05 07:53 PM
Lookup cell contents in on sheet based on a formula in second sheet Michael Wright via OfficeKB.com Excel Worksheet Functions 1 April 30th 05 04:11 PM


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