Multiple condition countif?

K

kshah_us

Hello,

How can I do some thing like this:

Count an occurance if value in col. A is "LifeMember" and value in Column E
is "Y" for a given range ? for instance A1:A100 and E1:E100 ?

I am trying COUNTIF but dont know how do I count only if BOTH conditions are
true?
 
F

FSt1

hi
countif in for 1 criteria. for more than one, might be better to use
sumproduct.
=sumproduct(--(A1:A100="lifemenber")*--(E1:E100="Y"))

Regards
FSt1
 
C

Chris Bode

Well, I suggest you to use macro instead
1.Right click on the toolbar > select control box
2. From the control box that appears on the sheet, select and draw
control box on the sheet
3.Double click the command button to open code window and past
following codes

Code
-------------------

Private Sub CommandButton1_Click()
Dim row As Integer, col As Integer
row = 1
col = 1

Dim count As Integer
count = 0
While Sheet1.Cells(row, col).Value <> ""
If Sheet1.Cells(row, col).Value = "LifeMember" And Sheet1.Cells(row, col + 4).Value = "Y" Then
count = count + 1
End If
row = row + 1
Wend

MsgBox "Count=" & count
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