# Shortest column in array?

#### StrawS

##### Board Regular
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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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.

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

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

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

then you need to loop through the array to check how many non-empty elements are there in each row.

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?

NO

right. That's what I needed to know.
Thank you

Replies
7
Views
581
Replies
0
Views
229
Replies
3
Views
295
Replies
10
Views
562
Replies
2
Views
330

1,218,841
Messages
6,144,793
Members
450,567
Latest member
Mplz

### 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.

### Which adblocker are you using?

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

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