0
votes

I am having an issue in Excel dragging to fill in formulas. I have formulas in rows such that each row has a different formula which reference to rows/cells on other sheets.

Let's say on Sheet 1, the formulas in the cells C2:C9 pulls data from Sheet 2 from cells C4, G4, H4, etc. If I highlight Sheet 1 cells C2:C9 and then click to drag down to form another group of formulas in cells C10:C17, the formulas inside change their reference by 8 rows such that if Sheet 1 C2 pulls data from Sheet 2 G4, the next similar formula in Sheet 1 C10 ends up pulling data from Sheet 2 G12.

This is the problem I am having; instead of the formulas changing to reference every 8 rows, how could I make it so that it only changes by 1 row instead? Or, for every new group of formulas dragged and filled, change the references in those formulas only by 1 row. If there is still confusion, consider if the cells C2:C9 were merged as a single cell. Even if you dragged that formula down, the formula inside would still change by 8 rows despite only forming 1 cell each time.

As far as I am aware, there is no built-in Excel function to do this and I believe the only way to do this would be some VBA code, but I am unfamiliar with VBA language. Since this would be a one time thing, the VBA code could either apply this 'row formatting' as I click and drag, or the VBA code could just automatically fill in the cells for me.

1

1 Answers

0
votes

Use INDEX() and some math:

In C2 it would be something like:

=INDEX(Sheet2!C:C,(ROW(1:1)-1)/8+4)

Where 8 is the spacing of the formula and 4 is the first row desired to return.

C2 would return Sheet2!C4, C10 would be Sheet2!C5

Using this you can modify the other formulas to return the desired pattern.