View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
zvkmpw zvkmpw is offline
external usenet poster
 
Posts: 153
Default Referring to a cell by using another cell for the row number

zvkmpw, that's a helpful suggestion, but unfortunately it doesn't solve my
problem, because every day I would like to pull values from a different set
of rows. I can't predict in advance which rows those will be, but I do have a
formula to calculate the rows. So I need a way to reference that formula.


OK, try this in a new tab, Sheet2

In Sheet2!A1, put a formula that returns the _FIRST_ row number of the range in FirstTab to be searched. The formula can take into account a date and/or other values.

In Sheet2!A2, put a formula that returns the _LAST_ row number of the range in FirstTab to be searched. The formula can take into account a date and/or other values.

In Sheet2!B1 put the value to be looked up in columnn A of FirstTab.

In Sheet2!B2, put
=VLOOKUP(B1,OFFSET(FirstTab!$A$1,$A$1-1,0,$A$2-$A$1+1,2),2,FALSE)
Hopefully, this does the needed lookup.

Explanation: The OFFSET(...) here returns a two-column sub-range inside FirstTab!A:B, limited by the row numbers computed in Sheet2!A1 and Sheet2!A2.

Modify or expand as needed.