Drag autofill in excel every x number of rows

时间:2015-07-28 23:50:49

标签: excel

I am vertically populating every 6 rows with 6 cells in another sheet, and then need to jump down a row in the reference for example:

self.tvc = [[MyTableViewController alloc] init];
[self.someOtherView addSubview:tvc.tableView];

Because I have thousands of rows that need to follow this pattern, I need to drag and have the drag follow the pattern above. Instead it jumps up by six each repetition.

B12  
C12  
D12  
E12  
F12  
G12  
B13  
C13  
D13  
E13  
F13  
G13  
B14  

1 个答案:

答案 0 :(得分:0)

To test, I entered B12 in cell B12, C12 in cell C12 etc down to G14 in cell G14

Put this in A1 and drag down:

<html>
    <head></head>
    <body>
        <form>
            <table>
                <tr>
                    <td>Departing</td>
                    <td>Returning</td>
                </tr>
                <tr></tr>
                <tr>
                    <td>
                        <input type="date" name="departing" required>
                    </td>
                    <td>
                        <input type="date" name="returning" id="rtndate" required>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="submit" value="Cheack Availability">
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>

It uses some basic maths to calculate and offset from cell A1

This calculates the row offset:

=OFFSET(A1,(12+TRUNC((ROW(A1)-1)/6))-ROW(A1),MOD(ROW(A1)-1,6)+1)

And this calculates the column offset:

(12+TRUNC((ROW(A1)-1)/6))-ROW(A1)

You can enter these as individual formulas to see how they work.

These are the results for the formula in my test sheet:

MOD(ROW(A1)-1,6)+1