OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[Solved] Array with same cell from different sheets.

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
thanasis31
Newbie
Newbie


Joined: 08 Feb 2012
Posts: 4

PostPosted: Fri Feb 10, 2012 1:58 am    Post subject: [Solved] Array with same cell from different sheets. Reply with quote

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
View user's profile Send private message
ken johnson
Super User
Super User


Joined: 23 Apr 2009
Posts: 2032
Location: Sydney, Australia

PostPosted: Fri Feb 10, 2012 3:50 am    Post subject: Reply with quote

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
View user's profile Send private message
thanasis31
Newbie
Newbie


Joined: 08 Feb 2012
Posts: 4

PostPosted: Fri Feb 10, 2012 4:24 am    Post subject: Reply with quote

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
View user's profile Send private message
ken johnson
Super User
Super User


Joined: 23 Apr 2009
Posts: 2032
Location: Sydney, Australia

PostPosted: Fri Feb 10, 2012 5:04 am    Post subject: Reply with quote

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
View user's profile Send private message
thanasis31
Newbie
Newbie


Joined: 08 Feb 2012
Posts: 4

PostPosted: Fri Feb 10, 2012 5:12 am    Post subject: Reply with quote

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
View user's profile Send private message
thanasis31
Newbie
Newbie


Joined: 08 Feb 2012
Posts: 4

PostPosted: Fri Feb 10, 2012 5:34 am    Post subject: Reply with quote

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
View user's profile Send private message
karolus
OOo Advocate
OOo Advocate


Joined: 22 Jun 2011
Posts: 210

PostPosted: Fri Feb 10, 2012 7:02 am    Post subject: Reply with quote

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
View user's profile Send private message
ken johnson
Super User
Super User


Joined: 23 Apr 2009
Posts: 2032
Location: Sydney, Australia

PostPosted: Fri Feb 10, 2012 2:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group