Matching a value in two worksheets, and then copying a cell from one to other



Hi there,
Noob alert :)
I have a workbook containing several worksheets. I will be adding another
worksheet that will, in effect, be a master for all of the other worksheets.
In the source worksheets (existing) there will be several employee id's
(unique) per sheet (sheets are different departments), and a seperate column
housing that employees pay rate. Any employee may work for one or more
departments, so there may be duplicate id's when considering all of the
worksheets, but in each, the id will be unique.
What I would like to do, is have the master worksheet with an individual
unique listing for every id appearing on the source sheets. Then, for
example, if one of the source sheets is named "Purchasing", I would like the
master to have a column for all purchasing pay-rates, should that employee
exist on the "Purchasing" sheet. I've been looking for something I could use
that would fulfill this psuedo code:

Copy pay rate from source to master Where employee id (source sheet) =
employee id (master sheet)

Then, in the master I could have a complete list of unique employees, each
row having a columns for each department.

Any ideas?





Here's a way to set it up dynamically using non-array formulas ..

Assuming identically structured source sheets named as: Purchasing,
Accounts, Store, Admin, etc where employee names are running in A2 down, and
Pay rates listed in B2 down, eg:

---------Pay rate
Emp1 3
Emp3 7
Emp4 6

Assume that all source sheets will contain up to a maximum of say, 10
employee names within A2:A11

In a sheet: X,

List the source sheetnames in any order in A1 down. Ensure these names match
exactly what's on the tabs (except for case)

Put in B1:

(Adjust the "10" within the INT(...) and MOD(...) to suit the max number of
employee names expected per sheet, in all the source sheets)

Put in C1:

Select B1:C1, copy down to cover the aggregated maximum expected no. of
employees in all the sheets. Eg if there's a total of 5 source sheets, copy
down to C50 (5 sheets x 10 rows each = 50 rows total)

X is a helper sheet to set it up for the extracts in the summary sheet

Then in the summary sheet, say: Z

Put in B1:
Copy B1 across as required to pull in all the source sheetnames as col
headers, eg copy B1 to F1 (for 5 source sheets)

Place in A2:

Put in B2:

Copy B2 across to F2. Then select A2:F2, copy down to cover the max expected
number of unique employees, eg down to F20 (say).

The above will return the required results dynamically from all the source
sheets. In col A will be returned the unique list of employees culled from
all source sheets, with employees' corresponding payrates (if any) listed
under the appropriate col headers in cols B to F. Employees not found in any
particular source sheet will have a "--" returned in the col. Adapt the "--"
return to suit.



The earlier set up fixes col B (ie "Pay rate" col, the key col) in the
source sheets as the desired return col. As an extension to the construct,
for greater flexibility as to which key col within the source sheets to
return the values within the summary sheet, try ...

In the summary sheet: Z,

Place this revised formula in B2 instead:
then copy B2 across to F2. Then select A2:F2, copy down to cover the max
expected number of unique employees, eg down to F20 (say), as before. Rest
of earlier construct remains unchanged.

Then we could have a simple DV droplist in A1 to select the desired key col
labels, eg: Pay rate, Hours, etc. The values returned in Z from all the
source sheets would then correspond to the key col label selected in A1. The
selectable col labels in the DV must of course be consistent with those
within all the source sheets' row1.

Here's a revised sample with the above implemented:
Dyn extract uniq emp list n keycol val fr var shts.xls


js4joe via

This is amazing. I am downloading the file you saved out now and can't wait
to get cracking on implementing your solution.
Thanks a million Max!




Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question