Selasa, 26 Mei 2009

Copy formula from sheet1 to sheet2 with row automaticly modified

Copy a formula across multiple row so that the row value increments automatically but not the row value
For Example :

The cell Sheet2!B32, has a formula of: =Sheet1!C9
After copy/paste, Cell Sheet2!B33 should have: =Sheet1!C47
After copy/paste, Cell Sheet2!B34 should have: =Sheet1!C85
After copy/paste, Cell Sheet2!B35 should have: =Sheet1!C123

Try this formula Sheet2!B32:

=INDIRECT("Sheet1!C"&(ROW()-31)*38-29)

OR...

The cell Sheet2!B32, has a formula of: =Sheet1!C10
After copy/paste, Cell Sheet2!B33 should have: =Sheet1!C48
After copy/paste, Cell Sheet2!B34 should have: =Sheet1!C86
After copy/paste, Cell Sheet2!B35 should have: =Sheet1!C124

Tri this :

=INDIRECT("Sheet1!C"&(ROW()-31) * 38 - 28)

How it work?

=(ROW()-31) converts row32 back into a value of 1.

Your target cells are C10, C48, C86...that's 38 rows difference each time. So I multiply my starting value by 38:

=(ROW()-31) * 38
...or
=1 * 38 = 38

Then we have to adjust for the actual first cell, which is in row 10. Since our current total is 38 and we need it to be 10, we subtract 28:

=(ROW()-31) * 38 - 28
...or
=1 * 38 - 28 = 10

Now, when you copy that formula down, the next answer will be 48, then 86...so it's working for picking row numbers. Add that into the INDIRECT() formula and it creates the reference for you.

Tidak ada komentar: