Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counta with CountIf

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Counta with CountIf

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Counta with CountIf

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, 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Counta with CountIf

=SUM(COUNTIF(A1:A200,{"John","Wanda"}))

--
---
HTH

Bob


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



wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
COUNTA or COUNTIF?? Jayme Excel Discussion (Misc queries) 7 September 4th 09 12:52 AM
Need help with Count, Counta, Countif Ayo Excel Discussion (Misc queries) 4 April 23rd 09 07:06 PM
If with countif or counta [email protected] Excel Worksheet Functions 3 September 28th 08 07:24 PM
CountIF, CountA,Which one? or neither? amy Excel Discussion (Misc queries) 2 July 20th 05 07:09 PM
COUNTA, COUNTIF? Newbie Excel Worksheet Functions 1 March 18th 05 11:33 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"