Sub DoTheMath()
Dim LastR As Long
With ActiveSheet
LastR = .Cells(.Rows.Count, "c").End(xlUp).Row
.Range("d2:d" & LastR).Formula = "=VLOOKUP(PERCENTRANK(C$2:C$" & LastR & _
",C2),{0,""D"";0.2500001,""C"";0.5000001,""B"";0.7500001,""A""},2)"
.Range("b" & (LastR + 2)) = "Total"
.Range("c" & (LastR + 2)).Formula = "=SUM(C2:C" & LastR & ")"
End With
End Sub
|