View Single Post
  #2  
Old May 29th, 2010, 10:41 PM posted to microsoft.public.excel.worksheet.functions
Don Guillett[_2_]
external usenet poster
 
Posts: 607
Default Count number of people

One way'
'=====
Option Explicit
Sub countem()
Dim c As Range
Dim lr As Long
Dim ms As Long

lr = Cells(Rows.Count, 1).End(xlUp).Row
For Each c In Range("a2:a" & lr)
If InStr(c, "&") Then
ms = ms + 2
Else
ms = ms + 1
End If
Next c
MsgBox ms
End Sub
'========
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"burtlake" wrote in message
news
We will be hosting a large fund raiser. I need to know the number of
people
attending. Here's my problem................

Some people come as couples, and some as singles. For example, I have
listed Jim & Susan Brown. But in the same list I have Bill Smith, and Ann
Johnson. If ALL of these people RSVP with a yes, it represents 4
attendees.

I think the key to determining if it is 1 or 2 people attending is the
ampersand "&". If I have an ampersand, it should count as two; no
ampersand,
it is 1.

How can I use a function or functions to make this distinction, anc
correctly enter the number of attendees in the spredsheet?