Skip to content

Instantly share code, notes, and snippets.

@halcwb
Last active July 27, 2023 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halcwb/4f37f8e619eda4edda22e209b70c9d1f to your computer and use it in GitHub Desktop.
Save halcwb/4f37f8e619eda4edda22e209b70c9d1f to your computer and use it in GitHub Desktop.
Calculate the a/A ratio
Sub Main
Console.WriteLine(CalcArterialAlveolarRatio(50, 60, 80))
End Sub
' Calculate the a/A ratio. Returns -1 if calculation not possible
' aARatio = 100 * PaO2 / (713 * FiO2 - PaCO2)
Function CalcArterialAlveolarRatio(dblPaCO2 As Double, dblPaO2 As Double, dblFiO2 As Double) As Double
Dim dblRatio As Double = -1
If dblFiO2 > 1 Then dblFiO2 = dblFiO2 / 100
If dblPaCO2 > 0 And dblPaO2 > 0 And dblFiO2 > 0 Then
dblRatio = 100 * dblPaO2 / (713 * dblFiO2 - dblPaCO2)
End If
Return dblRatio
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment