Shortest column in array?

StrawS

Board Regular
Joined
Jul 31, 2006
Messages
123
I have an array with two dimensions: a(1 to 8, 0 to 15).

When represented as a table, the first dimension would be columns and the second rows (ie: 8 columns, 15 rows).

Each column has a different number of rows used, ie:
column 1 has data in row 1 through 5,
column 2 has data in rows 1 through 10,
column 3 has data in rows 1 through 15,
column 4 doesn't have data in any row, etc

row 0 is always blank.

how can i find which column is shortest (not including blank columns)?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
I have an array with two dimensions: a(1 to 8, 0 to 15).

When represented as a table, the first dimension would be columns and the second rows (ie: 8 columns, 15 rows).
Wrong.

1st dim is Row and 2nd is Column
Each column has a different number of rows used, ie:
column 1 has data in row 1 through 5,
column 2 has data in rows 1 through 10,
column 3 has data in rows 1 through 15,
column 4 doesn't have data in any row, etc

row 0 is always blank.

how can i find which column is shortest (not including blank columns)?
You don't seem to understand what I meant...
Should be a(1 To 8, 1 To 15)

Why do you want to find the blanks in the array?

P.S
If you use array, learn the nature and basics of array first.
 

StrawS

Board Regular
Joined
Jul 31, 2006
Messages
123
Wrong.

1st dim is Row and 2nd is Column
ok, I want to find the longest row.



You don't seem to understand what I meant...
Should be a(1 To 8, 1 To 15)
ok...
  • Each row has a different number of columns used, ie:
    row 1 has data in columns 1 through 5,
    row 2 has data in columns 1 through 10,
    row 3 has data in columns 1 through 15,
    row 4 doesn't have data in any column, etc


Why do you want to find the blanks in the array?

You don't seem to understand what I meant...
I don't want to "find the blanks in the array"
I want to find the "shortest column in the array" (as per the thread subject)
... or as you have changed it - the shortest row in the array
 

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
You don't seem to understand what I meant...
Should be a(1 To 8, 1 To 15)
ok...
  • Each row has a different number of columns used, ie:
    row 1 has data in columns 1 through 5,
    row 2 has data in columns 1 through 10,
    row 3 has data in columns 1 through 15,
    row 4 doesn't have data in any column, etc
You don't seem to understand what I meant...
I don't want to "find the blanks in the array"
I want to find the "shortest column in the array" (as per the thread subject)
... or as you have changed it - the shortest row in the array
Each row/column in the array should have same size....
You really need to learn the basics of the array
 

StrawS

Board Regular
Joined
Jul 31, 2006
Messages
123

ADVERTISEMENT

yes, I understand that each row of the array is essentially the same length. I am referring to the data contained in each row:

when I said
Each row has a different number of columns used
i meant that they all have the same number of columns, but each row has a different number of columns *used*.

I even gave an example to illustrate the point.
maybe I need to elaborate so it's easier to understand...

  • row 1 has 15 columns but has data in columns 1 through 5,
    row 2 has 15 columns but has data in columns 1 through 10,
    row 3 has 15 columns and has data in columns 1 through 15,
    row 4 has 15 columns but doesn't have data in any column
    etc
 

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
then you need to loop through the array to check how many non-empty elements are there in each row.
 

StrawS

Board Regular
Joined
Jul 31, 2006
Messages
123

ADVERTISEMENT

that sounds like a tedious method, is there no command to use that will return the last column with data in a particular row of an array?
or the first blank column in a particular row?
 

Forum statistics

Threads
1,137,337
Messages
5,680,900
Members
419,937
Latest member
Talic

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
Top