Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 2
Unhappy Trying to count based on multiple criteria & cell comparisons

I have a table something like this:

A B
1234 1
1345 1
1345 2
1347 1
1355 1
1358 2
1366 1
1366 2
1375 1


Column A contains a variety of numbers which are usually unique, but sometimes duplicate.
Column B contains either a 1 or a 2.

My need is to count the number of times Column B = 2 AND the corresponding value for A is equal to the value for A of the previous row.

So for example, in the table above the first time B=2 is in B3. I then want the formula to slide over and compare to see if A3=A2 and if it does, to include B3 in the count.

I've been playing around with all sorts of strange formulas using COUNTIFS, OFFSET, MATCH, and others but I'm at a loss since I'm far from an excel guru.

Please help.

Thanks.

Last edited by theokester : September 21st 12 at 11:39 PM Reason: Wrong value in example description
  #2   Report Post  
Senior Member
 
Posts: 663
Default

Quote:
Originally Posted by theokester View Post
I have a table something like this:

A B
1234 1
1345 1
1345 2
1347 1
1355 1
1358 2
1366 1
1366 2
1375 1


Column A contains a variety of numbers which are usually unique, but sometimes duplicate.
Column B contains either a 1 or a 2.

My need is to count the number of times Column B = 2 AND the corresponding value for A is equal to the value for A of the previous row.

So for example, in the table above the first time B=2 is in B3. I then want the formula to slide over and compare to see if A3=A2 and if it does, to include B3 in the count.

I've been playing around with all sorts of strange formulas using COUNTIFS, OFFSET, MATCH, and others but I'm at a loss since I'm far from an excel guru.

Please help.

Thanks.
You could have an IF/AND statement in column C that shows a 1 if the two conditions are met and a 0 if not, then sum that column?

Put the below in C2 and copy down.
=IF(AND(B2=2,A2=A1),1,0)

Would that work for you?
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 51
Default Trying to count based on multiple criteria & cell comparisons

Il 22/09/2012 00:39, theokester ha scritto:
I have a table something like this:

A B
1234 1
1345 1
1345 2
1347 1
1355 1
1358 2
1366 1
1366 2
1375 1


Column A contains a variety of numbers which are usually unique, but
sometimes duplicate.
Column B contains either a 1 or a 2.

My need is to count the number of times Column B = 2 AND the
corresponding value for A is equal to the value for A of the previous
row.

So for example, in the table above the first time B=2 is in B3. I then
want the formula to slide over and compare to see if A3=A2 and if it
does, to include B3 in the count.

I've been playing around with all sorts of strange formulas using
COUNTIFS, OFFSET, MATCH, and others but I'm at a loss since I'm far from
an excel guru.

Please help.

Thanks.





Try:
=SUMPRODUCT((B2:B9=2)*(A2:A9=A1:A8))

Hi,
E.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 587
Default Trying to count based on multiple criteria & cell comparisons

hi,

=SUMPRODUCT(--(B2:B10=2)*--(A2:A10=A1:A9))

--
isabelle



Le 2012-09-21 18:39, theokester a écrit :
I have a table something like this:

A B
1234 1
1345 1
1345 2
1347 1
1355 1
1358 2
1366 1
1366 2
1375 1


Column A contains a variety of numbers which are usually unique, but
sometimes duplicate.
Column B contains either a 1 or a 2.

My need is to count the number of times Column B = 2 AND the
corresponding value for A is equal to the value for A of the previous
row.

So for example, in the table above the first time B=2 is in B3. I then
want the formula to slide over and compare to see if A3=A2 and if it
does, to include B3 in the count.

I've been playing around with all sorts of strange formulas using
COUNTIFS, OFFSET, MATCH, and others but I'm at a loss since I'm far from
an excel guru.

Please help.

Thanks.




  #5   Report Post  
Junior Member
 
Posts: 2
Default

Sorry it took so long to get back to y'all. Dealing with the whirlwind of corporate life.

This was very helpful.

Thanks. :)

Quote:
Originally Posted by isabelle View Post
hi,

=SUMPRODUCT(--(B2:B10=2)*--(A2:A10=A1:A9))

--
isabelle



Le 2012-09-21 18:39, theokester a écrit :
I have a table something like this:

A B
1234 1
1345 1
1345 2
1347 1
1355 1
1358 2
1366 1
1366 2
1375 1


Column A contains a variety of numbers which are usually unique, but
sometimes duplicate.
Column B contains either a 1 or a 2.

My need is to count the number of times Column B = 2 AND the
corresponding value for A is equal to the value for A of the previous
row.

So for example, in the table above the first time B=2 is in B3. I then
want the formula to slide over and compare to see if A3=A2 and if it
does, to include B3 in the count.

I've been playing around with all sorts of strange formulas using
COUNTIFS, OFFSET, MATCH, and others but I'm at a loss since I'm far from
an excel guru.

Please help.

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
Count with multiple criteria based on cell not blank? Twishlist Excel Worksheet Functions 7 January 13th 10 06:16 PM
Count based on multiple criteria Ashish Mathur[_2_] Excel Worksheet Functions 0 August 19th 09 03:19 AM
Count based on multiple criteria birdey Excel Discussion (Misc queries) 4 August 17th 09 06:19 PM
Count based on multiple criteria JP Ronse Excel Worksheet Functions 0 August 17th 09 02:13 PM
Using COUNTIF to count based on multiple cell criteria. Disdan Excel Worksheet Functions 5 November 30th 07 01:59 AM


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

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"