Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Counting a subset

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!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Counting a subset

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!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Counting a subset

=sumproduct((a1:a1000="X")*(b1:b1000250))
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!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Counting a subset

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!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Counting a subset

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" wrote in message
...
=sumproduct((a1:a1000="X")*(b1:b1000250))
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
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
Sum of a subset Gunder Excel Worksheet Functions 2 January 29th 09 01:49 PM
Sum of subset of an array Freeflyer Excel Worksheet Functions 1 June 3rd 08 05:51 PM
Populating a subset Will Excel Worksheet Functions 0 November 29th 06 02:09 PM
How to enter symbols for subset or element of a subset in Excel? rwcita Excel Worksheet Functions 1 January 23rd 06 09:27 PM
subset of numbers Bernard V Liengme Excel Programming 0 August 7th 03 08:05 PM


All times are GMT +1. The time now is 01:36 AM.

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

About Us

"It's about Microsoft Excel"