Referencing a single row to multiple rows in Excel
I have a worksheet with a list of sales, one sale per row. In order to import this data into my accounting software, I need to create a separate worksheet that formats the data differently. Each row from the first worksheet will take up four rows in the second worksheet.
I set up my four rows in the second worksheet and make all the relative references to the first row in the first worksheet. When I make a copy of the four rows the cell references are incorrect. For example, the first four rows should reference worksheet1!A1
. The next four rows should be referencing worksheet1!A2
. But if I try to do this by filling down A1:A4
, it references worksheet1!A5
.
I need a way to quickly duplicate those four rows and have the correct references. Here's how it should be.
worksheet1!A1 -> worksheet2!A1
worksheet1!A1 -> worksheet2!A2
worksheet1!A1 -> worksheet2!A3
worksheet1!A1 -> worksheet2!A4
worksheet1!A2 -> worksheet2!A5
worksheet1!A2 -> worksheet2!A6
worksheet1!A2 -> worksheet2!A7
worksheet1!A2 -> worksheet2!A8
At the moment, this is how it's coming out. You can see that three of the sales rows are just skipped over.
worksheet1!A1 -> worksheet2!A1
worksheet1!A1 -> worksheet2!A2
worksheet1!A1 -> worksheet2!A3
worksheet1!A1 -> worksheet2!A4
worksheet1!A5 -> worksheet2!A5
worksheet1!A5 -> worksheet2!A6
worksheet1!A5 -> worksheet2!A7
worksheet1!A5 -> worksheet2!A8
There is probably a really easy and obvious way to do this, but my Excel skills are limited, and I wasn't able to find anything on Google.
Solution moved on behalf of the OP from within the question to an answer.
I was able to work out a way to do it. It just divides the row number by four, then rounds up to the nearest whole number.
=INDIRECT("'worksheet1'!A"&ROUNDUP(ROW()/4, 0))
# My real world version looks more like this, as my rows don't actually start on row 1
=INDIRECT("'worksheet1'!A"&ROUNDUP((ROW()-1)/4, 0) + 8)