ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Number of rows/columns occupied (https://www.excelbanter.com/excel-worksheet-functions/216069-number-rows-columns-occupied.html)

Will

Number of rows/columns occupied
 
Is there a function which counts the number of
rows / columns in an Excel worksheet
which contain something (i.e. are not empty)?



Billy Liddel

Number of rows/columns occupied
 
=CountA(A:A)
=CountA(1:1)

"Will" wrote:

Is there a function which counts the number of
rows / columns in an Excel worksheet
which contain something (i.e. are not empty)?



Mike H

Number of rows/columns occupied
 
Hi,

Alt+F11 to open vb editor, right click 'This Workbook' and insert module and
paste these 2 UDF's below in

call with

=usedrows()
=usedcolumns()

Function UsedRows() As Long
UsedRows = ActiveSheet.UsedRange.Rows.Count
End Function

Function UsedColumns() As Long
UsedColumns = ActiveSheet.UsedRange.Columns.Count
End Function

Mike

"Will" wrote:

Is there a function which counts the number of
rows / columns in an Excel worksheet
which contain something (i.e. are not empty)?



Rick Rothstein

Number of rows/columns occupied
 
Those functions will count blank rows and/or blank columns that are located
within the UserRange (plus it is possible for the UsedRange to contain blank
rows and/or blank columns after the last piece of data in a row or column).

--
Rick (MVP - Excel)


"Mike H" wrote in message
...
Hi,

Alt+F11 to open vb editor, right click 'This Workbook' and insert module
and
paste these 2 UDF's below in

call with

=usedrows()
=usedcolumns()

Function UsedRows() As Long
UsedRows = ActiveSheet.UsedRange.Rows.Count
End Function

Function UsedColumns() As Long
UsedColumns = ActiveSheet.UsedRange.Columns.Count
End Function

Mike

"Will" wrote:

Is there a function which counts the number of
rows / columns in an Excel worksheet
which contain something (i.e. are not empty)?




Shane Devenshire[_2_]

Number of rows/columns occupied
 
Hi,

As stated the answer is no. You have asked for A function which counts all
the occupied rows and columns in a worksheet. There is no function that will
do both at once, rows and columns. Also, there is no built in function which
will calculate the number of occupied rows in all columns at once.

What you could do is insert a new column A and a new row in position 1,
enter the formula =COUNTA(B2:IV2) in A2 and copy it down as far as you want
65536 or 1,048,576 (2007). Then in A1 enter the formula =SUM(A2:A65536)

This will count the number of rows that have anything on them. You can do
something similar for columns.

Also, none of these formulas consider whether the cells are formatted if
that is important.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Will" wrote:

Is there a function which counts the number of
rows / columns in an Excel worksheet
which contain something (i.e. are not empty)?




All times are GMT +1. The time now is 12:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com