How to: Pivot Table - find intersection

mild.backspace

New Member
Joined
Jun 5, 2011
Messages
3
Hi,
Hoping someone can help with the following question

Sample Data
<table border="0" cellpadding="0" cellspacing="0" width="203"><colgroup><col style="width:48pt" width="64"> <col style="mso-width-source:userset;mso-width-alt:2742;width:56pt" width="75"> <col style="width:48pt" width="64"> </colgroup><tbody><tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;width:48pt" height="20" width="64">Name</td> <td class="xl65" style="border-left:none;width:56pt" width="75">Date</td> <td class="xl65" style="border-left:none;width:48pt" width="64">Visited</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">peter</td> <td class="xl66" style="border-top:none;border-left:none" align="right">01/12/2011</td> <td class="xl65" style="border-top:none;border-left:none">A</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">Jones</td> <td class="xl66" style="border-top:none;border-left:none" align="right">02/12/2011</td> <td class="xl65" style="border-top:none;border-left:none">A</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">Peter</td> <td class="xl66" style="border-top:none;border-left:none" align="right">01/12/2011</td> <td class="xl65" style="border-top:none;border-left:none">B</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">Angel</td> <td class="xl65" style="border-top:none;border-left:none">06/13/2011</td> <td class="xl65" style="border-top:none;border-left:none">B</td> </tr> </tbody></table>
Problem
Find users who exist in both categories? For example using the data above as reference I hope to have a pivot table that looks like the following.

As Peter has visited A and B both he only appears as a count in row heading "both" while vales for A and B is zero.

<table border="0" cellpadding="0" cellspacing="0" width="278"><colgroup><col style="width:48pt" width="64"> <col style="mso-width-source:userset;mso-width-alt:2742; width:56pt" span="2" width="75"> <col style="width:48pt" width="64"> </colgroup><tbody><tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;width:48pt" height="20" width="64">
</td> <td class="xl65" style="border-left:none;width:56pt" width="75">Dates</td> <td class="xl65" style="border-left:none;width:56pt" width="75">
</td> <td class="xl65" style="border-left:none;width:48pt" width="64">
</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">
</td> <td class="xl66" style="border-top:none;border-left:none" align="right">01/12/2011</td> <td class="xl66" style="border-top:none;border-left:none" align="right">02/12/2011</td> <td class="xl65" style="border-top:none;border-left:none">06/13/2011</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">Visited</td> <td class="xl65" style="border-top:none;border-left:none">
</td> <td class="xl65" style="border-top:none;border-left:none">
</td> <td class="xl65" style="border-top:none;border-left:none">
</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">A</td> <td class="xl65" style="border-top:none;border-left:none" align="right">0</td> <td class="xl65" style="border-top:none;border-left:none" align="right">1</td> <td class="xl65" style="border-top:none;border-left:none" align="right">0</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">B</td> <td class="xl65" style="border-top:none;border-left:none" align="right">0</td> <td class="xl65" style="border-top:none;border-left:none" align="right">0</td> <td class="xl65" style="border-top:none;border-left:none" align="right">1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">Both</td> <td class="xl65" style="border-top:none;border-left:none" align="right">1</td> <td class="xl65" style="border-top:none;border-left:none" align="right">0</td> <td class="xl65" style="border-top:none;border-left:none" align="right">0</td> </tr> </tbody></table>
Regards,
Mild

<table border="0" cellpadding="0" cellspacing="0" height="18" width="16"><tbody><tr style="height:15.0pt" height="20"><td class="xl63" style="height:15.0pt;width:48pt" height="20" width="64">
</td><td class="xl63" style="border-left:none;width:56pt" width="75">
</td><td class="xl63" style="border-left:none;width:48pt" width="64">
</td></tr><tr style="height:15.0pt" height="20"><td class="xl63" style="height:15.0pt;border-top:none" height="20">
</td><td class="xl64" style="border-top:none;border-left:none" align="right">
</td><td class="xl63" style="border-top:none;border-left:none">
</td></tr><tr style="height:15.0pt" height="20"><td class="xl63" style="height:15.0pt;border-top:none" height="20">
</td><td class="xl64" style="border-top:none;border-left:none" align="right">
</td><td class="xl63" style="border-top:none;border-left:none">
</td></tr><tr style="height:15.0pt" height="20"><td class="xl63" style="height:15.0pt;border-top:none" height="20">
</td><td class="xl64" style="border-top:none;border-left:none" align="right">
</td><td class="xl63" style="border-top:none;border-left:none">
</td></tr><tr style="height:15.0pt" height="20"><td class="xl63" style="height:15.0pt;border-top:none" height="20">
</td><td class="xl63" style="border-top:none;border-left:none">
</td><td class="xl63" style="border-top:none;border-left:none">
</td> </tr> </tbody></table>
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,226,693
Messages
6,192,471
Members
453,726
Latest member
JoeH57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top