Abstract
If you draw 7 cards from a complete deck of 52 cards without replacement, how likely is it that you will hold 3 aces?
Answer: around 0,58%
A formula solution to calculate likelihoods without replacement for this with Excel 365 or Excel 2021
=IFERROR(COMBIN(Elements_Drawn,SEQUENCE(1,Elements_Same + 1,0,1)) * (Elements_Same/Elements_Total)^SEQUENCE(1,Elements_Same + 1,0,1) * IFERROR((1 - Elements_Same/Elements_Total)^(Elements_Drawn-SEQUENCE(1,Elements_Same + 1,0,1)),1),0)
With replacement it would be
=IFERROR(COMBIN(Elements_Same,SEQUENCE(1,Elements_Same + 1,0,1))*COMBIN(Elements_Total - Elements_Same,Elements_Drawn-SEQUENCE(1,Elements_Same + 1,0,1))/COMBIN(Elements_Total,Elements_Drawn), 0)
These named ranges were defined:
Name | Value | Reference |
---|---|---|
Elements_Drawn | 7 | =Sheets1!$B$5 |
Elements_Same | 4 | =Sheets1!$B$4 |
Elements_Total | 52 | =Sheets1!$B$3 |
You can calculate the approximate likelihoods with a Monte Carlo Simulation:
Appendix – monte Code
Please read my Disclaimer.
Option Explicit
Function monte(bWithReplacement As Boolean, _
Optional runs As Long = 100000) As Variant
'Source (EN): https://www.sulprobil.com/likelihoods_en/
'Source (DE): https://www.bplumhoff.de/wahrscheinlichkeiten_de/
'(C) (P) by Bernd Plumhoff 27-Oct-2022 PB V0.2
Dim i As Long, j As Long, n As Long
Dim lAces As Long, lCards As Long
Dim lCardsDrawn As Long, lCardsSame As Long, lCardsTotal As Long
Dim r(1 To 5) As Variant
With Application.WorksheetFunction
lCardsTotal = Range("Elements_Total")
lCardsSame = Range("Elements_Same")
lCardsDrawn = Range("Elements_Drawn")
Randomize
For i = 1 To runs
n = 0
For j = 1 To lCardsDrawn
If bWithReplacement Then
lCards = lCardsTotal
lAces = lCardsSame
Else
lCards = lCardsTotal + 1 - j
lAces = lCardsSame - n
End If
If .RandBetween(1, lCards) < 1 + lAces Then
n = n + 1
If n = lCardsSame Then Exit For
End If
Next j
r(1 + n) = r(1 + n) + 1
Next i
For i = 1 To lCardsSame + 1: r(i) = r(i) / runs: Next i
monte = r
End With
End Function
Download
Please read my Disclaimer.
Likelihoods_Drawing_with_or_without_Replacement.xlsm [21 KB Excel file, open and use at your own risk]