Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lookup across multiple sheets 1

Status
Not open for further replies.

nat101

Programmer
Jul 5, 2001
147
0
0
US
Hi;

In a wb with multiple sheets, all having a number in a given cell (j2), I would like to get the sheetname (or return the value of another cell) of the sheet where (j2 > x).

Thank you in advance;
-nat
 
=INDEX(Sheet2!A:A,MATCH(A1,Sheet2!A:A,0))

I am barking up the right tree, but I forget the =if<> formula.. Hope this halps a little..

 
I don't understand where to substitue the START and END sheet in the formula you posted.

thanks
-nat
 
Hi,

1. On your worksheet, build a table of sheet names in your workbook
2. past formula in cells adjacent to sheet names
Code:
=INDIRECT(A2&&quot;!J2&quot;)
This will return the values in J2 on each sheet.
3. formula returning sheet name...
Code:
=IF(B2>X,A2,&quot;&quot;)
:)

Skip,
Skip@TheOfficeExperts.com
 
Thank you much. Right on, especially that I already had a column of all the sheet names.
One (un)related caveat though. Since this workbook has more than 500 sheets (using >350 meg ram!!) and since j2 on each sheet is a derived value (of a derived value...), there is a noticeable 'wait' (and page ripple) after any change on the sheet in any unrelated cell. Now, I know that I can turn auto-recalc off for the sheet, but preferbly I would like the INDIRECT function to execute only if x which is really cell M1 contains a value. So, when I put something in M1, let it ripple thru all the indirect functions, otherwise it should act as if all the cells with the indirect were null.

Thanks again
-nat
 
Well, you could make Calculate, Manual and hit F9 after changing M1.

If you wanted that to be &quot;automatic&quot; you could right-click the sheet tab (on the M1 sheet), select view code and paste this code...
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim rng As Range
    Set rng = Application.Intersect(Target, Range(&quot;M1&quot;))
    If Not rng Is Nothing Then ActiveSheet.Calculate
End Sub


Skip,
Skip@TheOfficeExperts.com
 
Oops,

should have included setting tng to Nothing
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim rng As Range
    Set rng = Application.Intersect(Target, Range(&quot;M1&quot;))
    If Not rng Is Nothing Then ActiveSheet.Calculate
    Set rng = Nothing
End Sub
[code]


Skip,
Skip@TheOfficeExperts.com
[URL unfurl="true"]www.TheOfficeExperts.com[/URL]
 
My question is really how Excel evaluates an IF function that returns false. Does it evaluate the 'true' portion anyhow? If it only evals the true portion when true, than I can wrap your INDIRECT function to return as part of the TRUE function of an IF M1 > 0.

Thanks again.
-nat
 
we both posted simultaneously..

I want calc to be automatic for everything else, EXCEPT for these two new columns that depend on M1.

ta
-nat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top