View Single Post
  #4   Report Post  
Biff
 
Posts: n/a
Default Limiting the range of a lookup function

Hi!

Assuming that there is an empty row between each employee's data set AND the
next row at the end of the entire range is empty:

Based on your sample data being in the range Sheet1A1:B13. Sheet2 is where
you want the data extracted to with the names starting in B1 and the dates
starting in A2.

Enter this formula in Sheet2 B2 as an array using the key combo of
CTRL,SHIFT,ENTER:

=VLOOKUP($A2,INDIRECT("Sheet1!A"&MATCH(B$1,Sheet1! $A$1:$A$14,0)&":B"&SMALL(IF(Sheet1!$A$1:$A$14="",R OW(Sheet1!A$1:A$14)),COLUMNS(Sheet1!$A:A))),2,0)

Copy across then down as needed.

Biff

"Dorn" wrote in message
...
I have data exported into excel from another program. The way the data is
presented is as follows:

Employee Name
Date data
Date data
Date data
Date data
Date data
Date data

Another Employee Name
Date data
Date data
Date data
Date data

and on and on,

What I'm trying to do is make a new tab that lists all of the employee
names
in a row and dates down a column and then use a look up function (I was
trying index, match) to compare the dates from both tabs enter the data
for
each employee. The problem I'm facing is that under each employees name
their are a different number of rows (some people didn't work some days),
so
I want to make the range for the look up to compare dates going down the
spreadsheet only until it hits a new employees name (or hits a row with
the
word "agent" in it) then I want it to continue comparing the dates and
entering the data, but I want the next employees data to show up under
their
name on the new spreadsheet. How do I make it so I don't have to choose a
set range? But make it so it looks between two values? Aaaagh sooo
confused.