Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 129
Default 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)?


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 527
Default 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)?


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default 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)?


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default 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)?



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default 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)?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
limited columns and rows number Aline New Users to Excel 2 December 20th 07 07:19 PM
Customize number of rows and columns Tuckland Excel Discussion (Misc queries) 3 May 8th 07 11:25 AM
Set number of columns/rows? Paddy Excel Discussion (Misc queries) 4 April 21st 07 06:13 PM
Maximun number of rows and columns OssieMac Excel Discussion (Misc queries) 3 March 22nd 07 09:52 AM
number of columns/rows andrewm Excel Discussion (Misc queries) 1 July 10th 05 12:12 PM


All times are GMT +1. The time now is 08:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"