PC Review


Reply
Thread Tools Rate Thread

Counta with CountIf

 
 
jpapanestor@gmail.com
Guest
Posts: n/a
 
      20th Dec 2007
I have looked at other posting and haven't seem to have found a
similar one or haven't understood explanations.

Here goes.

Column A could have either a value of John or Wanda without 200 rows

Over in Column J there will be an "x" (on the same row of the name) if
column A has a value of John or Wanda.

Visual Aid:

Col A Col J
John x
Wanda x
John x
John x
Wanda x

Totals would be John 3 Wanda 2


Objective is to get a total of John's "x" 's AND a total of Wanda's
"x" 's.

Totals will then be captured on another worksheet using a formuala
pointing to their respective totals.

Sounds so easy, but not yet there.

Please help!
Thanks in advance.
Jay
 
Reply With Quote
 
 
 
 
Incidental
Guest
Posts: n/a
 
      20th Dec 2007
Hi Jay

I'm not sure how to do this with Countif but the code below will do it
for.

Option Explicit
Dim MyCell, MyRng As Range
Dim CntJohn, CntWanda As Integer
Private Sub CommandButton1_Click()

CntJohn = 0
CntWanda = 0

Set MyRng = [A1:A200]

For Each MyCell In MyRng

If MyCell.Value = "John" And _
MyCell.Offset(0, 9).Value = "x" Then

CntJohn = CntJohn + 1

ElseIf MyCell.Value = "Wanda" And _
MyCell.Offset(0, 9).Value = "x" Then

CntWanda = CntWanda + 1

End If

Next MyCell

MsgBox "There were " & CntJohn & " John's" & vbNewLine & _
"in the list with an 'x' in the Column J" & vbNewLine & _
"And there were " & CntWanda & " Wanda's" & vbNewLine & _
"in the list with an 'x' in the Column J"

End Sub

I hope this helps

Steve

 
Reply With Quote
 
JP
Guest
Posts: n/a
 
      20th Dec 2007
Why not just count the number of occurrences of John and Wanda
directly?

John's total:

=COUNTIF(A1:A200,"John")

Wanda's total:

=COUNTIF(A1:A200,"Wanda")

Sum of both:

=COUNTIF(A1:A200,"John")+COUNTIF(A1:A200,"Wanda")



HTH,
JP



On Dec 20, 11:13 am, jpapanes...@gmail.com wrote:
> I have looked at other posting and haven't seem to have found a
> similar one or haven't understood explanations.
>
> Here goes.
>
> Column A could have either a value of John or Wanda without 200 rows
>
> Over in Column J there will be an "x" (on the same row of the name) if
> column A has a value of John or Wanda.
>
> Visual Aid:
>
> Col A Col J
> John x
> Wanda x
> John x
> John x
> Wanda x
>
> Totals would be John 3 Wanda 2
>
> Objective is to get a total of John's "x" 's AND a total of Wanda's
> "x" 's.
>
> Totals will then be captured on another worksheet using a formuala
> pointing to their respective totals.
>
> Sounds so easy, but not yet there.
>
> Please help!
> Thanks in advance.
> Jay


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      20th Dec 2007
=SUM(COUNTIF(A1:A200,{"John","Wanda"}))

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



<(E-Mail Removed)> wrote in message
news:752acadc-b769-4fd4-a7e4-(E-Mail Removed)...
>I have looked at other posting and haven't seem to have found a
> similar one or haven't understood explanations.
>
> Here goes.
>
> Column A could have either a value of John or Wanda without 200 rows
>
> Over in Column J there will be an "x" (on the same row of the name) if
> column A has a value of John or Wanda.
>
> Visual Aid:
>
> Col A Col J
> John x
> Wanda x
> John x
> John x
> Wanda x
>
> Totals would be John 3 Wanda 2
>
>
> Objective is to get a total of John's "x" 's AND a total of Wanda's
> "x" 's.
>
> Totals will then be captured on another worksheet using a formuala
> pointing to their respective totals.
>
> Sounds so easy, but not yet there.
>
> Please help!
> Thanks in advance.
> Jay



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
COUNTA or COUNTIF?? Jayme Microsoft Excel Misc 7 4th Sep 2009 12:52 AM
Need help with Count, Counta, Countif Ayo Microsoft Excel Misc 2 23rd Apr 2009 07:06 PM
If with countif or counta jamalhakem@gmail.com Microsoft Excel Worksheet Functions 3 28th Sep 2008 07:24 PM
CountIF, CountA,Which one? or neither? =?Utf-8?B?YW15?= Microsoft Excel Misc 2 20th Jul 2005 07:09 PM
COUNTA, COUNTIF? =?Utf-8?B?TmV3Ymll?= Microsoft Excel Worksheet Functions 1 18th Mar 2005 11:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:38 PM.