Maybe something along the lines of this set-up ..
Assume you have in Sheet1, in cols A to D,
data in row2 downwards, the set-up:
Name...........Reason....1st day of abs...Last day of abs
John Walt.......MC..........01-Jul-04..........01-Jul-04
Peter Logan.....V............02-Jul-04..........03-Jul-04
where details concerned for staff on vacation, on sick leave etc
(e.g. "V", "MC" etc in col B) are entered
Notes:
----------
a. The names in col A in Sheet1 are assumed *unique*,
i.e. appear maximum once only
b. For *single day* events, the same date has to be entered
in *both* cols C & D
(Like what was entered for "John Walt" in the sample above)
-------------
In Sheet2 (for month of Jul-04, say)
-------------
Suppose you have the typical set-up below, in cols A - col xx,
data in row2 downwards, where:
- Names are listed in col A, row2 down
(The names need not necessarily be in the same order as Sheet1)
- Row1 in cols B, C, D, etc contain all the *dates* for the entire month
in sequential order right across, viz.: 1-Jul-04, 2-Jul-04 .. 31-Jul-04
(Note: Your 4 extra cols in-between each week shouldn't be a problem
as long as the col headers for these in row1 doesn't contain any *dates*,
which might conflict)
Name...........1-Jul-04...2-Jul-04...3-Jul-04...etc
Peter Logan
John Walt
etc
Put in B2:
=IF(ISBLANK($A2),"",IF(ISNA(MATCH(TRIM($A2),Sheet1!$A:$A,0)),"Unmatched
OFFSET(Sheet1!$A$1,MATCH(TRIM($A2),Sheet1!$A:$A,0)-1,3)),"",OFFSET(Sheet1!$A
$1,MATCH(TRIM($A2),Sheet1!$A:$A,0)-1,1))))
Copy B2 right across until the rightmost col (for the last day of the
month),
then copy down until the last row of data in col A
The desired results for each name in col A will be returned by the formulae,
viz. for the sample data in Sheet1, Sheet2 will return:
Name...........01-Jul-04 02-Jul-04 03-Jul-04
Peter Logan........................V..............V
John Walt..........MC
Blank cells in col A (if any) will return blanks, while
"Unmatched Name" will be returned for cases
where the names in col A do not match those in Sheet1's col A
TRIM() is used to improve robustness in matching the names,
to remove any inadvertent leading, trailing or extra in-between-words spaces
in the names entered in col A of Sheet2