Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Estadisticas()
- Dim RutPacienteMayor As Integer
- Dim RutPaciente As Long
- Dim X As Integer
- Dim PromedioEdad As Double
- Dim Edad As Integer
- Dim SumaEdades As Integer
- Dim UltimaFila As Double
- Dim PromedioDiasGraves As Double
- Dim Dias As Integer
- Dim SumaDias As Integer
- Dim i As Integer
- RutPacienteMayor = 0
- If (RutPaciente > RutPacienteMayor) Then
- RutPacienteMayor = RutPaciente
- End If
- MsgBox ("El Rut del Paciente Mayor" & RutPacienteMayor & " ")
- UltimaFila = ActiveSheet.UsedRange.Row - 1 + ActiveSheet.UsedRange.Rows.Count
- For X = 2 To UltimaFila
- Edad = Range("D" & X)
- SumaEdades = SumaEdades + Edad
- Next
- If SumaEdades > 1 Then
- PromedioEdad = Round(SumaEdades / (UltimaFila - 1), 0)
- End If
- MsgBox ("El promedio es" & PromedioEdad & " ")
- For X = 2 To UltimaFila
- Dias = Range("K" & X)
- If Dias >= 1 Then
- SumaDias = SumaDias + Dias
- i = i + 1
- End If
- Next
- If SumaDias > 1 Then
- PromedioDiasGraves = Round(SumaDias / i, 0)
- End If
- MsgBox ("El promedio es" & PromedioDiasGraves & " ")
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement