Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Tim Tim is offline
external usenet poster
 
Posts: 145
Default finding the maximum number of used cells in any column of a table

[sorry if this appears cross-posted... the original is in
microsoft.public.excel.worksheetfunctions but that seems like a 'dead'
group]

Hi All,

I have a table of data, but not all of the cells in each column will be
filled. i am
trying to find a worksheet function that will return the maximum
number of rows filled by any of the coumns in the range. the result
will go on another sheet in the same workbook (ie, this is where the
excel function will be).

I can do it by using: -

=max(counta(A:A), counta(B:B), counta(C:C)) etc etc,

but in one case i have 41 columns (!) so i was wondering if there is
an easier way... i thought i might be able to use an array formula but
so far that has been unsuccessful. i know i could do it with VBA but
i am trying to avoid this route at the moment.

to clarify: the final answer will be a single cell indicating the maximum
number of cells filled in any one column (i don't need to know which column)

Thanks for any guidance,

Tim


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default finding the maximum number of used cells in any column of a table

Try one of these:

For only a few columns (eg 8 columns):
=MAX(SUBTOTAL(3,OFFSET($A:$A,,{0,1,2,3,4,5,6,7})))

Or...for 41 columns
(ARRAY FORMULA, committed with Ctrl+Shift+Enter, instead of just Enter):
=MAX(SUBTOTAL(3,OFFSET($A:$A,,ROW(INDEX(A:A,1):IND EX(A:A,41))-1)))

Or...for 41 columns (NON-array formula):
=MAX(INDEX(SUBTOTAL(3,OFFSET($A:$A,,ROW(INDEX(A:A, 1):INDEX(A:A,41))-1)),0))


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)


"Tim" <tmarsh-trousers-@-take off my trousers to reply-blueyonder.co.uk
wrote in message ...
[sorry if this appears cross-posted... the original is in
microsoft.public.excel.worksheetfunctions but that seems like a 'dead'
group]

Hi All,

I have a table of data, but not all of the cells in each column will be
filled. i am
trying to find a worksheet function that will return the maximum
number of rows filled by any of the coumns in the range. the result
will go on another sheet in the same workbook (ie, this is where the
excel function will be).

I can do it by using: -

=max(counta(A:A), counta(B:B), counta(C:C)) etc etc,

but in one case i have 41 columns (!) so i was wondering if there is
an easier way... i thought i might be able to use an array formula but
so far that has been unsuccessful. i know i could do it with VBA but
i am trying to avoid this route at the moment.

to clarify: the final answer will be a single cell indicating the maximum
number of cells filled in any one column (i don't need to know which
column)

Thanks for any guidance,

Tim




  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 527
Default finding the maximum number of used cells in any column of a table

or this may work

=COUNTA(Sheet1!A:D)/4

In anycase you need to reference the sheet to which the name refers so Ron's
second formula

=MAX(INDEX(SUBTOTAL(3,OFFSET(Sheet1!$A:$A,,ROW(IND EX(Sheet1!A:A,1):INDEX(Sheet1!A:A,41))-1)),0))

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Tim Tim is offline
external usenet poster
 
Posts: 145
Default finding the maximum number of used cells in any column of a table

brilliant - thank you (both)

out of interest, of the last two, is there any benefit in using an array
formula vs a non-array (in this instance)?

thanks

Tim

"Ron Coderre" wrote in message
...
Try one of these:

For only a few columns (eg 8 columns):
=MAX(SUBTOTAL(3,OFFSET($A:$A,,{0,1,2,3,4,5,6,7})))

Or...for 41 columns
(ARRAY FORMULA, committed with Ctrl+Shift+Enter, instead of just Enter):
=MAX(SUBTOTAL(3,OFFSET($A:$A,,ROW(INDEX(A:A,1):IND EX(A:A,41))-1)))

Or...for 41 columns (NON-array formula):
=MAX(INDEX(SUBTOTAL(3,OFFSET($A:$A,,ROW(INDEX(A:A, 1):INDEX(A:A,41))-1)),0))


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)


"Tim" <tmarsh-trousers-@-take off my trousers to reply-blueyonder.co.uk
wrote in message ...
[sorry if this appears cross-posted... the original is in
microsoft.public.excel.worksheetfunctions but that seems like a 'dead'
group]

Hi All,

I have a table of data, but not all of the cells in each column will be
filled. i am
trying to find a worksheet function that will return the maximum
number of rows filled by any of the coumns in the range. the result
will go on another sheet in the same workbook (ie, this is where the
excel function will be).

I can do it by using: -

=max(counta(A:A), counta(B:B), counta(C:C)) etc etc,

but in one case i have 41 columns (!) so i was wondering if there is
an easier way... i thought i might be able to use an array formula but
so far that has been unsuccessful. i know i could do it with VBA but
i am trying to avoid this route at the moment.

to clarify: the final answer will be a single cell indicating the maximum
number of cells filled in any one column (i don't need to know which
column)

Thanks for any guidance,

Tim






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default finding the maximum number of used cells in any column of a table

Hi, Tim

I haven't clocked the array vs non-array versions. I generally suggest
non-array versions because they don't require Ctrl+Shift+Enter to make them
functional. Whenever *my* typical users edit an array formula, they ALWAYS
forget to C+S+E and there's no automatic flag in the cell to remind them.
Although, I sometimes tack this reminder on the end of array formulas with
no non-array alternative:

+N("commit with C+S+E")

Does that help?
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)




"Tim" <tmarsh-trousers-@-take off my trousers to reply-blueyonder.co.uk
wrote in message ...
brilliant - thank you (both)

out of interest, of the last two, is there any benefit in using an array
formula vs a non-array (in this instance)?

thanks

Tim

"Ron Coderre" wrote in message
...
Try one of these:

For only a few columns (eg 8 columns):
=MAX(SUBTOTAL(3,OFFSET($A:$A,,{0,1,2,3,4,5,6,7})))

Or...for 41 columns
(ARRAY FORMULA, committed with Ctrl+Shift+Enter, instead of just Enter):
=MAX(SUBTOTAL(3,OFFSET($A:$A,,ROW(INDEX(A:A,1):IND EX(A:A,41))-1)))

Or...for 41 columns (NON-array formula):
=MAX(INDEX(SUBTOTAL(3,OFFSET($A:$A,,ROW(INDEX(A:A, 1):INDEX(A:A,41))-1)),0))


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)


"Tim" <tmarsh-trousers-@-take off my trousers to reply-blueyonder.co.uk
wrote in message ...
[sorry if this appears cross-posted... the original is in
microsoft.public.excel.worksheetfunctions but that seems like a 'dead'
group]

Hi All,

I have a table of data, but not all of the cells in each column will be
filled. i am
trying to find a worksheet function that will return the maximum
number of rows filled by any of the coumns in the range. the result
will go on another sheet in the same workbook (ie, this is where the
excel function will be).

I can do it by using: -

=max(counta(A:A), counta(B:B), counta(C:C)) etc etc,

but in one case i have 41 columns (!) so i was wondering if there is
an easier way... i thought i might be able to use an array formula but
so far that has been unsuccessful. i know i could do it with VBA but
i am trying to avoid this route at the moment.

to clarify: the final answer will be a single cell indicating the
maximum number of cells filled in any one column (i don't need to know
which column)

Thanks for any guidance,

Tim










  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Tim Tim is offline
external usenet poster
 
Posts: 145
Default finding the maximum number of used cells in any column of a table

.... helps alot!!

i normally think of myself as pretty competent with Excel (particularly
compared with my colleagues!) and i've obviously used all of those functions
you provided individually, but it would have taken me A LONG TIME to
construct those formulae.

once again, thank you Ron,

Tim

"Ron Coderre" wrote in message
...
Hi, Tim

I haven't clocked the array vs non-array versions. I generally suggest
non-array versions because they don't require Ctrl+Shift+Enter to make
them functional. Whenever *my* typical users edit an array formula, they
ALWAYS forget to C+S+E and there's no automatic flag in the cell to remind
them. Although, I sometimes tack this reminder on the end of array
formulas with no non-array alternative:

+N("commit with C+S+E")

Does that help?
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)




"Tim" <tmarsh-trousers-@-take off my trousers to reply-blueyonder.co.uk
wrote in message ...
brilliant - thank you (both)

out of interest, of the last two, is there any benefit in using an array
formula vs a non-array (in this instance)?

thanks

Tim

"Ron Coderre" wrote in message
...
Try one of these:

For only a few columns (eg 8 columns):
=MAX(SUBTOTAL(3,OFFSET($A:$A,,{0,1,2,3,4,5,6,7})))

Or...for 41 columns
(ARRAY FORMULA, committed with Ctrl+Shift+Enter, instead of just Enter):
=MAX(SUBTOTAL(3,OFFSET($A:$A,,ROW(INDEX(A:A,1):IND EX(A:A,41))-1)))

Or...for 41 columns (NON-array formula):
=MAX(INDEX(SUBTOTAL(3,OFFSET($A:$A,,ROW(INDEX(A:A, 1):INDEX(A:A,41))-1)),0))


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)


"Tim" <tmarsh-trousers-@-take off my trousers to reply-blueyonder.co.uk
wrote in message ...
[sorry if this appears cross-posted... the original is in
microsoft.public.excel.worksheetfunctions but that seems like a 'dead'
group]

Hi All,

I have a table of data, but not all of the cells in each column will be
filled. i am
trying to find a worksheet function that will return the maximum
number of rows filled by any of the coumns in the range. the result
will go on another sheet in the same workbook (ie, this is where the
excel function will be).

I can do it by using: -

=max(counta(A:A), counta(B:B), counta(C:C)) etc etc,

but in one case i have 41 columns (!) so i was wondering if there is
an easier way... i thought i might be able to use an array formula but
so far that has been unsuccessful. i know i could do it with VBA but
i am trying to avoid this route at the moment.

to clarify: the final answer will be a single cell indicating the
maximum number of cells filled in any one column (i don't need to know
which column)

Thanks for any guidance,

Tim










  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default finding the maximum number of used cells in any column of a table

Hi, Tim

I'm glad I could help!
-------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)


"Tim" <tmarsh-trousers-@-take off my trousers to reply-blueyonder.co.uk
wrote in message ...
... helps alot!!

i normally think of myself as pretty competent with Excel (particularly
compared with my colleagues!) and i've obviously used all of those
functions you provided individually, but it would have taken me A LONG
TIME to construct those formulae.

once again, thank you Ron,

Tim

"Ron Coderre" wrote in message
...
Hi, Tim

I haven't clocked the array vs non-array versions. I generally suggest
non-array versions because they don't require Ctrl+Shift+Enter to make
them functional. Whenever *my* typical users edit an array formula, they
ALWAYS forget to C+S+E and there's no automatic flag in the cell to
remind them. Although, I sometimes tack this reminder on the end of array
formulas with no non-array alternative:

+N("commit with C+S+E")

Does that help?
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)




"Tim" <tmarsh-trousers-@-take off my trousers to reply-blueyonder.co.uk
wrote in message ...
brilliant - thank you (both)

out of interest, of the last two, is there any benefit in using an
array formula vs a non-array (in this instance)?

thanks

Tim

"Ron Coderre" wrote in message
...
Try one of these:

For only a few columns (eg 8 columns):
=MAX(SUBTOTAL(3,OFFSET($A:$A,,{0,1,2,3,4,5,6,7})))

Or...for 41 columns
(ARRAY FORMULA, committed with Ctrl+Shift+Enter, instead of just
Enter):
=MAX(SUBTOTAL(3,OFFSET($A:$A,,ROW(INDEX(A:A,1):IND EX(A:A,41))-1)))

Or...for 41 columns (NON-array formula):
=MAX(INDEX(SUBTOTAL(3,OFFSET($A:$A,,ROW(INDEX(A:A, 1):INDEX(A:A,41))-1)),0))


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)


"Tim" <tmarsh-trousers-@-take off my trousers to
reply-blueyonder.co.uk wrote in message
...
[sorry if this appears cross-posted... the original is in
microsoft.public.excel.worksheetfunctions but that seems like a 'dead'
group]

Hi All,

I have a table of data, but not all of the cells in each column will
be filled. i am
trying to find a worksheet function that will return the maximum
number of rows filled by any of the coumns in the range. the result
will go on another sheet in the same workbook (ie, this is where the
excel function will be).

I can do it by using: -

=max(counta(A:A), counta(B:B), counta(C:C)) etc etc,

but in one case i have 41 columns (!) so i was wondering if there is
an easier way... i thought i might be able to use an array formula but
so far that has been unsuccessful. i know i could do it with VBA but
i am trying to avoid this route at the moment.

to clarify: the final answer will be a single cell indicating the
maximum number of cells filled in any one column (i don't need to know
which column)

Thanks for any guidance,

Tim












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
Finding Number of cells in a column of other sheet having a specific word in them [email protected] New Users to Excel 5 February 21st 07 01:51 PM
Finding row & column given value in a Table brutonparish Excel Worksheet Functions 1 August 4th 06 03:43 AM
Finding the closest number in column A and take the value in column B reefguy Excel Worksheet Functions 3 May 5th 06 07:25 PM
Finding a maximum number...with an exception cubsfan Excel Discussion (Misc queries) 1 April 7th 06 06:48 PM
Finding a number in a table? JoeBed Excel Discussion (Misc queries) 10 June 4th 05 11:52 PM


All times are GMT +1. The time now is 12:13 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"