PC Review


Reply
Thread Tools Rate Thread

Counting Unique Pairs of Cells

 
 
Makaron
Guest
Posts: n/a
 
      17th Jun 2008
I am trying to count unique pairs of cells in different columns. For
instance, I have:

"A" "C"
1 apples
2 oranges
2 oranges
2 oranges
3 bananas
4 oranges
4 oranges
5 apples
oranges
6
7 apples
7 apples

I am trying to count the total number of unique pairs of cells that have
particular (non-blank) entry in the second column AND a nonzero corresponding
value in the first (for example, for "oranges" I would like to end up with a
count of 2; for "apples" - with 3, and a total count of 6)

Thank you very much in advance - I appreciate it!
 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      17th Jun 2008
In D1, enter:

=A1 & C1 and copy down

and then count uniques in column D:

http://www.cpearson.com/excel/Duplicates.aspx
--
Gary''s Student - gsnu200792


"Makaron" wrote:

> I am trying to count unique pairs of cells in different columns. For
> instance, I have:
>
> "A" "C"
> 1 apples
> 2 oranges
> 2 oranges
> 2 oranges
> 3 bananas
> 4 oranges
> 4 oranges
> 5 apples
> oranges
> 6
> 7 apples
> 7 apples
>
> I am trying to count the total number of unique pairs of cells that have
> particular (non-blank) entry in the second column AND a nonzero corresponding
> value in the first (for example, for "oranges" I would like to end up with a
> count of 2; for "apples" - with 3, and a total count of 6)
>
> Thank you very much in advance - I appreciate it!

 
Reply With Quote
 
Max
Guest
Posts: n/a
 
      17th Jun 2008
Another straightforward play which gets you there ..

Assume data as posted in cols A and C, from row2 down

In D2, copied down:
=IF(SUMPRODUCT((A$2:A2<>"")*(C$2:C2<>"")*(A$2:A2=A2)*(C$2:C2=C2))>1,"",SUMPRODUCT((A$2:A2<>"")*(C$2:C2<>"")*(A$2:A2=A2)*(C$2:C2=C2)))

Then, assuming you have listed the unique fruits:
apples, oranges, bananas
in F2:F4

Simply, place in G2, copy down: =SUMIF(B:B,E2,C:C)
will return the required figs for each fruit
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Makaron" wrote:
> I am trying to count unique pairs of cells in different columns. For
> instance, I have:
>
> "A" "C"
> 1 apples
> 2 oranges
> 2 oranges
> 2 oranges
> 3 bananas
> 4 oranges
> 4 oranges
> 5 apples
> oranges
> 6
> 7 apples
> 7 apples
>
> I am trying to count the total number of unique pairs of cells that have
> particular (non-blank) entry in the second column AND a nonzero corresponding
> value in the first (for example, for "oranges" I would like to end up with a
> count of 2; for "apples" - with 3, and a total count of 6)
>
> Thank you very much in advance - I appreciate it!

 
Reply With Quote
 
Max
Guest
Posts: n/a
 
      17th Jun 2008
Errata, line below should have read as:
> Simply, place in G2, copy down: =SUMIF(C:C,F2,D)

--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---

 
Reply With Quote
 
T. Valko
Guest
Posts: n/a
 
      17th Jun 2008
Try this array formula** :

=COUNT(1/FREQUENCY(IF((A2:A13<>"")*(C2:C13<>""),MATCH(A2:A13&C2:C13,A2:A13&C2:C13,0)),ROW(A2:A13)-MIN(ROW(A2:A13))+1))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

--
Biff
Microsoft Excel MVP


"Makaron" <(E-Mail Removed)> wrote in message
news:C1BDD9BD-18A5-4C3F-ACA8-(E-Mail Removed)...
>I am trying to count unique pairs of cells in different columns. For
> instance, I have:
>
> "A" "C"
> 1 apples
> 2 oranges
> 2 oranges
> 2 oranges
> 3 bananas
> 4 oranges
> 4 oranges
> 5 apples
> oranges
> 6
> 7 apples
> 7 apples
>
> I am trying to count the total number of unique pairs of cells that have
> particular (non-blank) entry in the second column AND a nonzero
> corresponding
> value in the first (for example, for "oranges" I would like to end up with
> a
> count of 2; for "apples" - with 3, and a total count of 6)
>
> Thank you very much in advance - I appreciate it!



 
Reply With Quote
 
Makaron
Guest
Posts: n/a
 
      17th Jun 2008
Thank you very much - great job!

"Max" wrote:

> Errata, line below should have read as:
> > Simply, place in G2, copy down: =SUMIF(C:C,F2,D)

> --
> Max
> Singapore
> http://savefile.com/projects/236895
> xdemechanik
> ---
>

 
Reply With Quote
 
Max
Guest
Posts: n/a
 
      17th Jun 2008
welcome, glad it worked for you
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Makaron" <(E-Mail Removed)> wrote in message
news:B790CBD8-7CD0-4F20-A979-(E-Mail Removed)...
> Thank you very much - great job!



 
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
Counting for unique values using 2 cells =?Utf-8?B?S2VpdGg=?= Microsoft Excel Worksheet Functions 6 3rd Jul 2007 06:14 PM
Counting only Unique cells =?Utf-8?B?Qm9i?= Microsoft Excel Worksheet Functions 11 9th Jun 2006 06:19 PM
Counting Unique Empty Cells of a Range IronDogg Microsoft Excel Programming 7 9th Apr 2006 05:38 PM
Excel VBA - Counting Unique Cells in a Range wuming Microsoft Excel Misc 2 7th Jul 2004 09:50 AM
Formulas for...1. Counting unique cells 2. Display unique contents J Microsoft Excel Programming 0 23rd Apr 2004 09:20 PM


Features
 

Advertising
 

Newsgroups
 


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