PC Review


Reply
Thread Tools Rate Thread

Counting a subset

 
 
Kent McPherson
Guest
Posts: n/a
 
      4th Dec 2007
I have data with multiple columns. I want to count all items in column A =
"X" and with column B > 250. I know how to do either condition but I need
to join the two. Any help would be appreciated. Thanks!


 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      4th Dec 2007
This could do it.

For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If Cells(i, 1) = "X" and Cells(i, 1).Offset(0, 1) > 250 Then
'Do things
End If
Next

"Kent McPherson" wrote:

> I have data with multiple columns. I want to count all items in column A =
> "X" and with column B > 250. I know how to do either condition but I need
> to join the two. Any help would be appreciated. Thanks!
>
>
>

 
Reply With Quote
 
excelent
Guest
Posts: n/a
 
      4th Dec 2007
=sumproduct((a1:a1000="X")*(b1:b1000>250))
change range to fit


"Kent McPherson" skrev:

> I have data with multiple columns. I want to count all items in column A =
> "X" and with column B > 250. I know how to do either condition but I need
> to join the two. Any help would be appreciated. Thanks!
>
>
>

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      4th Dec 2007
Sorry Kent, I forgot to put the counter on it.

Sub cnt()
Counter = 0
For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If Cells(i, 1) = "X" and Cells(i, 1).Offset(0, 1) > 250 Then
'Do things
Counter = Counter + 1
End If
Next
MsgBox Counter
End Sub

"Kent McPherson" wrote:

> I have data with multiple columns. I want to count all items in column A =
> "X" and with column B > 250. I know how to do either condition but I need
> to join the two. Any help would be appreciated. Thanks!
>
>
>

 
Reply With Quote
 
Kent McPherson
Guest
Posts: n/a
 
      10th Dec 2007
Thanks, I've tried this formula but it doesn't give me the right answer.
For example, I should get an answer of 3 but it gives me 10. If I change
either parameter to 1, I get the proper count but when it's together, I get
the wrong answer. Is there any way to debug? Suggestions?

"excelent" <(E-Mail Removed)> wrote in message
news:284B586E-E65C-4226-8E61-(E-Mail Removed)...
> =sumproduct((a1:a1000="X")*(b1:b1000>250))
> change range to fit
>
>
> "Kent McPherson" skrev:
>
>> I have data with multiple columns. I want to count all items in column A
>> =
>> "X" and with column B > 250. I know how to do either condition but I
>> need
>> to join the two. Any help would be appreciated. Thanks!
>>
>>
>>



 
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
Sum of a subset Gunder Microsoft Excel Worksheet Functions 2 29th Jan 2009 01:49 PM
make query to return a subset only if not in another subset Peridot Microsoft Access Queries 1 28th Jun 2008 12:06 AM
How to enter symbols for subset or element of a subset in Excel? =?Utf-8?B?cndjaXRh?= Microsoft Excel Worksheet Functions 1 23rd Jan 2006 09:27 PM
Why CLS is subset of CTS manoj.sahu@finalquadrant.com Microsoft VB .NET 0 28th Dec 2005 01:01 PM
Subset query =?Utf-8?B?QmFja2lu?= Microsoft Access Queries 2 16th May 2005 11:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:16 PM.