Reply
 
Thread Tools Display Modes
  #1   Report Post  
Bradley C. Hammerstrom
 
Posts: n/a
Default Count non-blank cells in a table column

The field code {=Count(Below)} works for me, but I want to skip blank cells
in the column. How?


  #2   Report Post  
macropod
 
Posts: n/a
Default

Hi Bradley,

Word's 'Above', 'Below', 'Right' and 'Left' field expressions are quirky at
the best of times - see 'Referencing Adjacent Cells In A Row Or Column' in
the Word document at:
http://www.wopr.com/cgi-bin/w3t/show...?Number=365442
(url all one line)

Having said that, you can't reliably avoid counting empty/blank cells with
{=Count(Below)}. A possible workaround, if you're counting cells with '1' in
them (or another non-zero numeric constant), might be to use something based
on {=Sum(Below)}.

Cheers


"Bradley C. Hammerstrom" bhammerstrom @ NOTTYSPAMrhadcock.com wrote in
message ...
The field code {=Count(Below)} works for me, but I want to skip blank

cells
in the column. How?




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 19/11/2004


  #3   Report Post  
Greg Maxey
 
Posts: n/a
Default

Bradley,

I don't know how you could do this with a field. I played with a macro
today that if you put your cursor in the a blank cell in the column then it
will count a inert the number of "non-empty" fields.

Sub Test()
Dim i As Long, j As Long
Dim iCount As Long
Dim oCell As Cell
Dim oCol As Column

If Selection.Information(wdWithInTable) = True Then
i = Selection.Cells(1).RowIndex
j = Selection.Cells(1).ColumnIndex
End If
For Each oCell In Selection.Tables(1).Columns(j).Cells
If oCell.Range.Characters.Count 1 Then
iCount = iCount + 1
End If
Next
ActiveDocument.Tables(1).Cell(i, j).Range.InsertBefore "Count = " & iCount &
" "


End Sub

--
Greg Maxey/Word MVP
A Peer in Peer to Peer Support

Bradley C. Hammerstrom wrote:
The field code {=Count(Below)} works for me, but I want to skip blank
cells in the column. How?



  #4   Report Post  
Luke Moraga
 
Posts: n/a
Default

I believe you will want to use the code "COUNTA". It is specifaclly designed
to counta only non-blank cells. Also, if you want to only count cells that
contain numbers, i.e. don't count a heading, use "DCOUNT". Hope htis helps.

"Bradley C. Hammerstrom" wrote:

The field code {=Count(Below)} works for me, but I want to skip blank cells
in the column. How?



  #5   Report Post  
macropod
 
Posts: n/a
Default

Hi Luke,

It might if the application was Excel, but this is a Word table ...

Cheers


"Luke Moraga" wrote in message
...
I believe you will want to use the code "COUNTA". It is specifaclly

designed
to counta only non-blank cells. Also, if you want to only count cells that
contain numbers, i.e. don't count a heading, use "DCOUNT". Hope htis

helps.

"Bradley C. Hammerstrom" wrote:

The field code {=Count(Below)} works for me, but I want to skip blank

cells
in the column. How?





Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dragging table column resets Sedonakids Tables 0 January 12th 05 01:11 AM
Ideas for macro to add row for count and percentage Bradley C. Hammerstrom Tables 8 January 6th 05 10:38 AM
Count below not including blank cells Bradley C. Hammerstrom Tables 1 December 14th 04 10:23 AM
how can I use autosum in a WORD table with blank cells Jennifer from DPI Tables 4 November 11th 04 07:30 AM
using table style in 1st column Hutystng29 Tables 1 November 9th 04 02:31 PM


All times are GMT +1. The time now is 10:57 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"