Calculate infection probability in group of people

Imagine that you want to arrange a meeting or birthday party for 40 people in the area where are infected people. What is the chance that one of them will come to your event? This probability can be calculated.

I created simple Excel macro to do the math. It uses birthday paradox rule.

You have to know population in the area and number of currently infected people in this area.

Sub covid()
  totalPopulation = Range("B1").Value2
  activeCovidCases = Range("B2").Value2
  groupSize = Range("B3").Value2
  p = 1
  For i = 0 To groupSize - 1
    p = p * ((totalPopulation - i - activeCovidCases) / (totalPopulation - i))
  Next

  Range("B8").Value2 = (1 - p) * 100
End Sub

Template looks like this:

covid-group-area

Download file: probability-of-infection-in-group.xlsm

Add a comment »6 comments to this article

  1. I was a broke man who has always not found luck when it comes to playing the lottery. I have been playing the lottery jackpot since i was 21 years old, and now i am 45 years old, meaning i have been playing lottery for 24 years now. The biggest amount I have ever won in my life was 1,500 bucks. But one day, my story turns to history after I find this man’s name on the Internet that he is the best when it comes to giving lottery numbers to win. This man is a very strong voodoo spell caster who gives out the numbers that can never fail. After all my years of laboring and struggling to win the lottery i finally won ( $29,000,000) Dr Zuma is the name of the spell caster and his Email Address:  spiritualherbalisthealing@gmail.com this opportunity come to me by luck for getting his contact.

    Reply

  2. This is exactly what I have looking for. Infection probability calculator in Excel. Is there any change to generate statistics from this results? I need overview of number of infected people progression in time. It will be great to have this data in chart.

    Regards Laura

    Reply

  3. The for loop in VBA could be done without macro. In this case the PRODUCT() function will do the job.

    Reply

  4. Hello,

    is this macro or formula applicable for all diseases or just a COVID-19 infection?

    Reply

    • Yes,

      this procedure has universal usage. It is general formula for probability calculation. It can be used for Covid infection calculation or any other diseases or whatever. For example what is the probability of having blue car in your neighbourhood. But it is necessary to know all base numbers which will be used in the function.

      Reply

  5. WOW,

    I didn’t expect these numbers. It is better to do math than to believe in intuition. Thank you.

    Reply



Copyright © All Rights Reserved · Green Hope Theme by Sivan & schiy · Proudly powered by WordPress