LEFTARRAY

=LEFTARRAY(array,n,direction)

array
array to be evaluated
n
number of columns (or rows, or both) to be returned
direction
0 or blank to return n columns, 1 to return n rows, 2 to return n columns and rows

LEFTARRAY returns the LEFT N columns (or rows or both) of an array.

RicoS

Board Regular
Joined
May 1, 2019
Messages
62
LEFTARRAY returns the LEFT N columns (or rows or both) of an array.

Excel Formula:
=LAMBDA(array,n,direction,INDEX(array,SEQUENCE(IF(direction=0,ROWS(array),n)),SEQUENCE(,IF(direction=1,COLUMNS(array),n))))

Lambda - Last Cell and Split.xlsx
BCDEFGHIJKLMNO
1Original ArrayLeft 2 ColumnsLeft 2 RowsLeft 2 columns and rows
2thisismythisisthisismythisis
3arrayofwordsarrayofarrayofwordsarrayof
4ornumberslikeornumbers
512312
6
Sheet1
Cell Formulas
RangeFormula
F2:G5F2=LEFTARRAY($B$2:$D$5,2,)
I2:K3I2=LEFTARRAY($B$2:$D$5,2,1)
M2:N3M2=LEFTARRAY($B$2:$D$5,2,2)
Dynamic array formulas.
 
Upvote 0
Is it possible to somehow change LEFTARRAY so that one could use
=SUM(LEFTARRAY(B8:M8,A1,))
where A1 holds number of columns?

(Yes I know there are more ways to do what I want)
 
Hans, I would suggest not! LEFTARRAY has been superceded by "official" Microsoft functions such as TAKE, or DROP. They would work much better for what you want to do I think.
 
@RicoS
Thank you.
You are quite rtight =SUM(TAKE(B3:M3,,A1)) works fine.
 

Forum statistics

Threads
1,215,895
Messages
6,127,624
Members
449,390
Latest member
joan12

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