Chooserows function help with variable number of rows

braindiesel

Well-known Member
Joined
Mar 16, 2009
Messages
571
Office Version
  1. 365
  2. 2019
  3. 2010
Platform
  1. Windows
I am trying to build a part of a dashboard, and I want to pull the first 8 rows... but I really want UP TO 8 rows
Currently I am using a variation of
=CHOOSEROWS(myarray,1,2,3,4,5,6,7,8)

but My array has filters in it so the array may only be 5 items long, producing an error...
I really want it to be
=CHOOSEROWS(myarray,1,2,3,4,5,6,7,8) if 8 rows but =CHOOSEROWS(myarray,1,2,3,4) if only 4 rows

Any help with how to make my ROW NUMBERS variable is greatly appreciated
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
=TAKE(myarray, MIN(8,ROWS(myarray)))
 
Upvote 1
Solution
You could also use
Excel Formula:
=take(myarray,8)
If you have less than 8 rows Take will simple return all the rows
 
Upvote 0

Forum statistics

Threads
1,215,372
Messages
6,124,532
Members
449,169
Latest member
mm424

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