| View previous topic :: View next topic |
| Author |
Message |
thanasis31 Newbie

Joined: 08 Feb 2012 Posts: 4
|
Posted: Fri Feb 10, 2012 1:58 am Post subject: [Solved] Array with same cell from different sheets. |
|
|
Goodmorning,
Let's say that I have 10 calc sheets, SheetA, SheetB etc.
I'm interested in A1 cell in each sheet.
I create another sheet in the same workbook, call it SheetZ.
On this last sheet I want to create an array with 10 rows and 1 column.
The contents of this array will be:
SheetA.A1
SheetB.A1
..
..
..
SheetJ.A1.
Is there a formula available to do this?
Thanks a lot!
Last edited by thanasis31 on Fri Feb 10, 2012 5:37 am; edited 1 time in total |
|
| Back to top |
|
 |
ken johnson Super User

Joined: 23 Apr 2009 Posts: 1845 Location: Sydney, Australia
|
Posted: Fri Feb 10, 2012 3:50 am Post subject: |
|
|
One way with SheetZ.A1 being the first cell of the array...
| Code: | | =INDIRECT("Sheet"&CHOOSE(ROW(A1)-ROW(A$1)+1;"A";"B";"C";"D";"E";"F";"G";"H";"I";"J")&".A1") | in SheetZ.A1 filled down to SheetZ.A10.
Ken Johnson _________________ If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button). |
|
| Back to top |
|
 |
thanasis31 Newbie

Joined: 08 Feb 2012 Posts: 4
|
Posted: Fri Feb 10, 2012 4:24 am Post subject: |
|
|
Thank you for replying.
I tried what you suggested and what I got on SheetZ.A1 was the content of SheetA.A1.
Nothing more.
edit: My fault. Your formula did exactly what I asked.
There is something else. It seems that if I try renaming one sheet, I get an error502 which makes sense. The name of each sheet that I've got refers to a country. So, it's rather like
AU BE BG and so on. How can I alter the formula you proposed in order to get on my summary sheet the array:
AU.A1
BE.A1
BG.A1 |
|
| Back to top |
|
 |
ken johnson Super User

Joined: 23 Apr 2009 Posts: 1845 Location: Sydney, Australia
|
Posted: Fri Feb 10, 2012 5:04 am Post subject: |
|
|
Try...
| Code: | | =INDIRECT("Sheet"&CHOOSE(ROW(A1)-ROW(A$1)+1;"AU";"BE";"BG";"?";"?";"?";"?";"?";"?";"?")&".A1") |
after changing each "?" to the appropriate country codes.
Ken Johnson _________________ If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button). |
|
| Back to top |
|
 |
thanasis31 Newbie

Joined: 08 Feb 2012 Posts: 4
|
Posted: Fri Feb 10, 2012 5:12 am Post subject: |
|
|
This works only if sheets are renamed
SheetAU
SheetBE
SheetBG
etc
Can this work if sheets are
AU
BE
BG
etc...
Thank you! |
|
| Back to top |
|
 |
thanasis31 Newbie

Joined: 08 Feb 2012 Posts: 4
|
Posted: Fri Feb 10, 2012 5:34 am Post subject: |
|
|
| Code: | | =INDIRECT(CHOOSE(ROW(A1)-ROW(A$1)+1;"AU";"BE";"BG";"?";"?";"?";"?";"?";"?";"?")&".A1") |
I used this and it worked!
Thank you very much.
You cannot imagine how much trouble I avoided due to your help.
I will change the thread title to solved. |
|
| Back to top |
|
 |
karolus OOo Advocate

Joined: 22 Jun 2011 Posts: 208
|
Posted: Fri Feb 10, 2012 7:02 am Post subject: |
|
|
Hi
| Quote: | | =INDIRECT(CHOOSE(ROW(A1)-ROW(A$1)+1;"AU";... |
The red Part is senseless, replace it with:
=INDIRECT(CHOOSE(ROW(A1);"AU";....
Karo |
|
| Back to top |
|
 |
ken johnson Super User

Joined: 23 Apr 2009 Posts: 1845 Location: Sydney, Australia
|
Posted: Fri Feb 10, 2012 2:34 pm Post subject: |
|
|
| karolus wrote: | Hi
| Quote: | | =INDIRECT(CHOOSE(ROW(A1)-ROW(A$1)+1;"AU";... |
The red Part is senseless, replace it with:
=INDIRECT(CHOOSE(ROW(A1);"AU";....
Karo |
The red part is just a way of future-proofing against what would happen after a new row is inserted at row 1.
After a new row is inserted at row 1 ROW(A1)-ROW(A$1)+1 updates to ROW(A2)-ROW(A$2)+1. Both the original and updated formulae return 1.
ROW(A1), however would update to ROW(A2) resulting in the first formula of the array returning the second sheet name instead of the first; an undesirable result.
Ken Johnson |
|
| Back to top |
|
 |
|