Displaying items from a column list in another sheet?

P

pieman3

Hi

Does anyone know how to display content from sequential cells in a column
which is in another sheet in the same workbook and then continue repeat this?

I need the content from these cells to be displayed in a row of cells but
the crucial thing is that I need the cells to repeat the list from the
beginning once a blank cell is reached in the original column. I'll try an
example to make this clearer...

1. There is Sheet A with column A1:A20 containing the names of 20 products.
2. There is Sheet B with row A1:AN1 containing 40 cells

In this example Sheet B should copy all the 20 product names then get to
cell 21 and find a blank cell at 'SheetA!A21' so start the list from the
beginning again. This should occur no matter how many cells are calling the
original list of 20 products but as soon as it finds a blank cell at the end
of the list of 20 products it should go back to the beginning and start
displaying from cell 1. Please note that there should be no limit on the
number of cells in the original product list.

Hopefully I've made it easier to understand and not harder. Any ideas would
be much appreciated.

Thanks
Simon
 
J

joel

Put this formula in sheet2 in cell A1. Then copy across Row 1 to column AN

=INDEX(Sheet1!$A:$A,MOD(COLUMN()-1,COUNTA(Sheet1!$A:$A))+1,1)

The formual assumes ther is only the data you want in column A with nothing
after the last character. The formula uses index(Reference Cell, Row,
Column) Where Reference is Sheet1!A1 and the column is always 1. the row
Number isn sheet 1 is the same as the column number in sheet 2. I use the
MOD function so when you get to the end of the data in Sheet 1 it repeats.
 
P

pieman3

Thanks Joel, will this still work if the row number in sheet2 is different
from the column number in sheet1?

Simon
 
J

joel

Yes, it only uses the column number on sheet 2.

pieman3 said:
Thanks Joel, will this still work if the row number in sheet2 is different
from the column number in sheet1?

Simon
 
P

pieman3

Hi Joel

Is there a way to specify a specific column cell range on sheet1 as there is
other text in that column which is also being listed and repeated?

Thanks
Simon
 
J

joel

Can you explain better?

If you want
sheet 2 Row 1 to be sheet 1 column A
sheet 2 Row 2 to be sheet 1 column B
sheet 2 Row 3 to be sheet 1 column C

this will work
=INDEX(Sheet1!$A:$A,MOD(COLUMN()-1,COUNTA(Sheet1!$A:$A))+1,Row())

I change the last 1 to Row()
 
P

pieman3

Yeah sure...

Column A in sheet 1 has the list of products I need repeating on Sheet 2 but
this column also contains a text heading in the cell above the product list.
With your first formula suggestion the list title in column A of sheet 1 was
also being copied and repeated in row A1 of Sheet 2.

Ideally, it would be best if I could specify the range of cells containing
the original list in sheet 1 to be copied and repeated in sheet 2.

Is that possible?

Thanks
Simon
 
J

joel

There is nothing from stopping you from replacing Sheet1!$A:$A (2x) with
Sheet1!A$2:A$100
 
P

pieman3

I tried that but for some reason it always missed the first item in the list
and started at the 2nd item.
 
P

pieman3

This is the formula I just tried...

=INDEX(Sheet1!A$2:A$100,MOD(COLUMN()-1,COUNTA(Sheet1!A$2:A$100)),ROW())

But I get an invalid cell reference error. Have I missed something?
 
J

joel

The one is needed and $ are needed in front of the column A

=INDEX(Sheet1!$A$2:A$100,MOD(COLUMN()-1,COUNTA(Sheet1!$A$2:A$100))+1,ROW())
 
J

joel

This function assume there is a header row in Sheet 1

In sheet 2 A1
=OFFSET(Sheet1!$A$1,MOD(COLUMN()-1,COUNTA(INDIRECT("Sheet1!C"&ROW(),FALSE))-1)+1,ROW()-1)
 
S

simon

Thanks Joel, that formula works but restricts the list to row A1 on sheet 2.
Is there a way to be able to specify any row on sheet 2 as I will need to use
this formula on different sheets with different row locations?

Thanks
Simon
 
J

joel

If in sheet 2 the table starts in A5

=OFFSET(Sheet1!$A$1,MOD(COLUMN()-1,COUNTA(INDIRECT("Sheet1!C"&ROW()-ROW($A$5)+1,FALSE))-1)+1,ROW()-ROW($A$5))
 
S

simon

Thanks Joel, that does work better. How would this work if the row in sheet 2
started at B5? Cell A5 contains the row label so I don't want that to be
listed.

Simon
 
J

joel

I change the reference from B5 to A5. Thought it was eaier to understand.
the A1 included the header row on sheet 1, A5 now includes header column.

=OFFSET(Sheet1!$A$1,MOD(COLUMN()-COLUMN($A$5)-1,COUNTA(INDIRECT("Sheet1!C"&ROW()-ROW($A$5)+1,FALSE))-1)+1,ROW()-ROW($A$5))
 
S

simon

Thanks Joel that works great and gives me some flexibility over where to copy
the list to.

Is there a way to achieve the same result if there are cells on a row on
Sheet 2 with breaks. So for example, row B5 is where the list starts but
cells E5 and F5 should be left blank and the repeating list continues from
cell G5?

Thanks again
Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top