#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Sumproduct query

Hi,

I'm using sumproduct to count occurences for multiple criteria, but have a
question...

How can I use it for the following situation:

A B C
1 Y N Y
2 Y N N
3 N N N
4 Y Y Y

I'm looking to count every occurence of one or more Y.

Cheers
Marc
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 694
Default Sumproduct query

Hi Marc
You could use =COUNTIF(A1:C4,"Y")
HTH
John
"Marc T" wrote in message
...
Hi,

I'm using sumproduct to count occurences for multiple criteria, but have a
question...

How can I use it for the following situation:

A B C
1 Y N Y
2 Y N N
3 N N N
4 Y Y Y

I'm looking to count every occurence of one or more Y.

Cheers
Marc


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Sumproduct query

Hi John,

Thanksfor the reply, but what I'm needing to count is the number of rows
that contain one or more Y rather than every Y that occurs.

Marc


"John" wrote:

Hi Marc
You could use =COUNTIF(A1:C4,"Y")
HTH
John
"Marc T" wrote in message
...
Hi,

I'm using sumproduct to count occurences for multiple criteria, but have a
question...

How can I use it for the following situation:

A B C
1 Y N Y
2 Y N N
3 N N N
4 Y Y Y

I'm looking to count every occurence of one or more Y.

Cheers
Marc



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Sumproduct query

"Marc T" wrote:
what I'm needing to count is the number of rows that
contain one or more Y rather than every Y that occurs.


One way:

=SUMPRODUCT(--((A1:A4="y")+(B1:B4="y")+(C1:C4="y")0))

In all of your examples, column A is "y", which might allow some incorrect
formulas seem to work when they really don't. You should also test with an
example where column A is not "y", but one or more other columns is.


----- original message -----

"Marc T" wrote in message
...
Hi John,

Thanksfor the reply, but what I'm needing to count is the number of rows
that contain one or more Y rather than every Y that occurs.

Marc


"John" wrote:

Hi Marc
You could use =COUNTIF(A1:C4,"Y")
HTH
John
"Marc T" wrote in message
...
Hi,

I'm using sumproduct to count occurences for multiple criteria, but
have a
question...

How can I use it for the following situation:

A B C
1 Y N Y
2 Y N N
3 N N N
4 Y Y Y

I'm looking to count every occurence of one or more Y.

Cheers
Marc


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Sumproduct query

One way

Sub countrowsif()
mc = "j"
For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row
If Application.CountIf(Rows(i), "=" & "y") 0 Then
ms = ms + 1
End If
Next i
MsgBox ms
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Marc T" wrote in message
...
Hi,

I'm using sumproduct to count occurences for multiple criteria, but have a
question...

How can I use it for the following situation:

A B C
1 Y N Y
2 Y N N
3 N N N
4 Y Y Y

I'm looking to count every occurence of one or more Y.

Cheers
Marc


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
Sumproduct query Scrunch Excel Worksheet Functions 9 October 13th 08 11:51 PM
SUMPRODUCT query John Excel Discussion (Misc queries) 3 March 18th 08 10:57 PM
Sumproduct query shakey1181 Excel Discussion (Misc queries) 7 May 18th 07 02:49 PM
SUMPRODUCT IF query sdg8481 Excel Discussion (Misc queries) 1 March 6th 07 05:25 PM
SUMPRODUCT Query penri0_0 Excel Discussion (Misc queries) 7 June 7th 06 12:22 PM


All times are GMT +1. The time now is 01:58 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"