How to put data into an array?

excelos

Well-known Member
Joined
Sep 25, 2011
Messages
591
Office Version
  1. 365
Platform
  1. Windows
Hello

I want to create an array with dynamic data (that is not a simple range), what is the best way to do that?

E.g. how can I create an array with A1:A5,A10:A15 ?

From my reading, it seems there are few ways, like creating a SEQUENCE first etc but what is the optimal and most flexible way?

Thanks!
 
thanks all, @bebo021999 is quite close to what I need, I used CHOOSE in the past, also SEQUENCE, but wondered what is the most flexible/capable way?
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
but wondered what is the most flexible/capable way?
How would we know when we do not know exactly what you want?
You said bebo is "quite close" but that implies that you actually want something a bit different. What is it that you actually want?
 
Upvote 0
This collect A1:A5 and A11:A15 into a 2D array
=CHOOSE({1,2},A1:A5,A11:A15)
Then, for example, SUM:
=SUM(CHOOSE({1,2},A1:A5,A11:A15))
Book1
ABCDEF
11#VALUE!{1,7;2,8;3,9;4,10;5,11}
2260
33
44
55
6
7
8
9
10
117
128
139
1410
1511
Sheet1
Cell Formulas
RangeFormula
D1D1=CHOOSE({1,2},A1:A5,A11:A15)
D2D2=SUM(CHOOSE({1,2},A1:A5,A11:A15))
Thanks, that's interesting that you can choose arrays instead of specific values! Is it possible to put the array one below the other than next to other?
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,631
Members
449,241
Latest member
NoniJ

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top