[VBA] Calculate how often does two person appear at the same time

smallxyz

Active Member
Joined
Jul 27, 2015
Messages
393
Office Version
  1. 2021
Platform
  1. Windows
Attached below is a sample data.
The purpose is to create a table (shown below) which summarizes how often do two persons occur at the same time.

E.g.
Use "Rebecca" as an example.
Total count of "Rebeceaa" occurence in all invoices = 4.
For invoice number 4, "Wendy" and "Mary" also exist at the same time with "Rebecca".
So their occurrence frequency relative to "Rebecca" would be 1/4 (25%) and 1/4 (25%) respectively.

I would like to automate the above process ( fill-up the whole table ) via vba or any other way convenient and fast.
I get a large data set, >1000 data row. Manual calculation would be deadly.
Hope someone can help.



Excel 2012
ABCDEFGHIJKLM
1InvoiceNameTotal Count
21RebeccaBetty4
34WendyKen1
44RebeccaMary3
54MaryPhilip2
65MaryRebecca4
710BettySusan1
810BettyThomas2
910BettyTom1
1022PhilipWendy1
1124Rebecca
1226BettySimultaneous Occurrence for same invoice (= ccurrence / total count )
1328TomBettyKenMaryPhilipRebeccaSusanThomasTomWendy
1428SusanBetty
1529ThomasKen
1630ThomasMary
1730PhilipPhilip
1836KenRebecca25%100%25%
1937MarySusan
2041RebeccaThomas
21Tom
22Wendy
工作表3





Thanks a lot!
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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