Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dragging table column resets | Tables | |||
Ideas for macro to add row for count and percentage | Tables | |||
Count below not including blank cells | Tables | |||
how can I use autosum in a WORD table with blank cells | Tables | |||
using table style in 1st column | Tables |