Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Stretch
 
Posts: n/a
Default Count with Hidden cells

Is there a way to count the number of text filled cells excluding the cells
that I have hidden?
  #2   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

Depends on the version of excel, excel 2003 works like

=SUBTOTAL(103,A1:A10)

won't count hidden cells

--
Regards,

Peo Sjoblom

(No private emails please)


"Stretch" wrote in message
...
Is there a way to count the number of text filled cells excluding the
cells
that I have hidden?


  #3   Report Post  
Stretch
 
Posts: n/a
Default

What does the 103 stand for?

"Peo Sjoblom" wrote:

Depends on the version of excel, excel 2003 works like

=SUBTOTAL(103,A1:A10)

won't count hidden cells

--
Regards,

Peo Sjoblom

(No private emails please)


"Stretch" wrote in message
...
Is there a way to count the number of text filled cells excluding the
cells
that I have hidden?



  #4   Report Post  
Stretch
 
Posts: n/a
Default

Also, I have 2002 instead of 2003. Any ideas on how it works for that?

"Peo Sjoblom" wrote:

Depends on the version of excel, excel 2003 works like

=SUBTOTAL(103,A1:A10)

won't count hidden cells

--
Regards,

Peo Sjoblom

(No private emails please)


"Stretch" wrote in message
...
Is there a way to count the number of text filled cells excluding the
cells
that I have hidden?



  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

The 3 in 103 represents the =CountA() function.

Look at xl's help for all 11 of these codes.

xl2003 adds 100 to each of those 11 to tell =subtotal() to ignore both the rows
hidden by filters and rows hidden manually.



Stretch wrote:

What does the 103 stand for?

"Peo Sjoblom" wrote:

Depends on the version of excel, excel 2003 works like

=SUBTOTAL(103,A1:A10)

won't count hidden cells

--
Regards,

Peo Sjoblom

(No private emails please)


"Stretch" wrote in message
...
Is there a way to count the number of text filled cells excluding the
cells
that I have hidden?




--

Dave Peterson


  #6   Report Post  
Dave Peterson
 
Posts: n/a
Default

I think you'll need a userdefined function.

Option Explicit
Function myCount(rng As Range)
Application.Volatile True

Dim myCell As Range
Dim myCtr As Long

myCtr = 0
For Each myCell In rng.Cells
If IsEmpty(myCell) _
Or myCell.EntireRow.Hidden = True _
Or myCell.EntireColumn.Hidden = True Then
'do nothing, ignore it
Else
myCtr = myCtr + 1
End If
Next myCell

myCount = myCtr

End Function

======
In xl2002, I don't think that hiding rows causes a recalculation, though. You
may want to hit F9 before you trust the result of the UDF. (xl2003 recalcs when
you hide a row--but you don't need this kind of function in xl2003--as Peo
said.)

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
Into a test cell and type:
=mycount(a2:a33)



Stretch wrote:

Also, I have 2002 instead of 2003. Any ideas on how it works for that?

"Peo Sjoblom" wrote:

Depends on the version of excel, excel 2003 works like

=SUBTOTAL(103,A1:A10)

won't count hidden cells

--
Regards,

Peo Sjoblom

(No private emails please)


"Stretch" wrote in message
...
Is there a way to count the number of text filled cells excluding the
cells
that I have hidden?




--

Dave Peterson
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
Character Count Range of Cells Naz Excel Discussion (Misc queries) 0 May 29th 05 10:28 PM
copying with hidden cells KyWilde Excel Worksheet Functions 2 May 20th 05 10:51 PM
paste over hidden cells KyWilde Excel Discussion (Misc queries) 0 May 20th 05 12:50 AM
Can I count how many grey-filled cells are in a row ? AnthonyG Excel Worksheet Functions 1 February 4th 05 10:08 AM
Calculating without including Hidden Cells LiquidFire Excel Discussion (Misc queries) 3 November 29th 04 08:35 PM


All times are GMT +1. The time now is 06:59 AM.

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"