Help me with a formula in Table

J

Jean-Guy Marcil

BigOz said:
I want a count.

in column F2:F27, how many "F" (or "M") are there in the column

Can you embed an Excel table instead?
It would be so much easier in Excel!
 
M

macropod

Hi BigOz,

You can find the cell address for a given cell by running the following macro. The cell address is displayed on the status bar.
Sub CellAddress()
If Selection.Information(wdWithInTable) = True Then
If Selection.Cells(1).ColumnIndex > 26 Then
StatusBar = "Cell Address: " & Chr(64 + Int(Selection.Cells(1).ColumnIndex / 26)) & _
Chr(64 + (Selection.Cells(1).ColumnIndex Mod 26)) & Selection.Cells(1).RowIndex
Else
StatusBar = "Cell Address: " & Chr(64 + Selection.Cells(1).ColumnIndex) & _
Selection.Cells(1).RowIndex
End If
End If
End Sub
 
M

macropod

Hi BigOz,

On re-reading your post, I believe you'd need a macro to do the count in Word. For example:

Sub GenderCount()
Dim F As Integer
Dim M As Integer
Dim i As Integer
Dim CelTxt As Range
F = 0
M = 0
With Selection
If .Information(wdWithInTable) = True Then
With .Range.Tables(1)
If .Rows.Count < 27 Then
MsgBox "Only " & .Rows.Count & " rows in selected table!", vbCritical
Exit Sub
End If
If .Columns.Count < 6 Then
MsgBox "Only " & .Columns.Count & " columns in selected table!", vbCritical
Exit Sub
End If
For i = 2 To 27
Set CelTxt = .Cell(i, 6).Range
CelTxt.End = CelTxt.End - 1
If CelTxt.Text = "F" Then F = F + 1
If CelTxt.Text = "M" Then M = M + 1
Next
MsgBox "Count of 'F' entries: " & F & vbCrLf & "Count of 'M' entries: " & M
End With
Else
MsgBox "No table selected!", vbCritical
End If
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top