View Single Post
  #4   Report Post  
Roland
 
Posts: n/a
Default Formula to copy rng of cells where (value is met) to anther sheet

Brian,

I have here a rudimentary solution. It can be tweaked, but for a quick
solution this will work.

Put a helper column in column A of your "Primary" sheet, using the row()
function, to create a sequential list. Your data should now look something
like this, with the headings in row 1.

COL A COL B COL C
Row ID DATA
2 44 1
3 44 2
4 68 3
5 68 4
6 28 5
7 28 5
8 28 5
9 28 5
10 28 5
11 28 5
12 28 6

Now on another sheet, using the sheet name "Loc28", put the heading Row
in cell A1.

In cell A2 type this formula
=MIN(IF((Primary!$A$1:$A$12A2)*(Primary!$B$1:$B$1 2=28),Primary!$A$1:$A$12)).
Use <ctrl <shift <enter to make it an array formula. You should see { }
brackets around the formula. (Use a longer range that to A12 and B12 to
match your data.)

Cell A2 will ready as zero. Copy the formula down a few cells. You'll
now see data as below, representing rows from the "Primary" sheet.

Row
0
6
7
8
9
10
11
12
0

When it gets to zero, here after the 12, you can erase that row and those
below it, for it will repeat.

Now use the VLOOKUP function to lookup data based on the Row values.

Then repeat, using sheets for your other two locations, 44 and 68.

Tweaking the array formula to test for text values can eliminate the
leading zero and another tweak can eliminate the repeats, turning them into
99999's or some such, but that would complicate the array formula too much
for this discussion. Do that later.










Exit Advantage" wrote:

I have one sheet that contains info for all three office locations. One
column on this sheet contains location ID. I want to create three seperate
sheets for each office, then have a formula that will copy the info from a
row on the primary sheet to respective office sheet. Office locations are 28,
44 and 68. So if column c on main sheet =28 then copy all rows where column c
= 28 to 28 sheet, etc with 44 and 68. Please help, I can't figure it out.

Thanks,
Brian