My two examples are my two favorite quarterbacks in both the NFL and in College and their best two seasons.
| Quarterback | Yr. | Division | Attempts | Completions | Yards | TD | Int | QB Rate |
|---|---|---|---|---|---|---|---|---|
| Patrick Mahomes | 2018 | NFL | 580 | 383 | 5097 | 50 | 12 | 113.8 |
| Chase Daniel | 2008 | NCAA | 528 | 385 | 4335 | 39 | 18 | 159.4 |
if (model.league == "nfl")
{
double a = ((model.comp / model.att) - 0.3) * 5; //part 1 of formula
double b = ((model.yds / model.att - 3) * 0.25); //part 2 of formula
double c = ((model.td / model.att) * 20); // part 3 of formula
double d = 2.375 - ((model.inter / model.att) * 25); //part 4 of formula
/*
* NFL QBR requires the result of any calculation to be non-negative and no more than 2.375
* It also states, if it is a negative number, set it to 0
* or if it's greater than 2.375, set it to 2.375
*/
a = Math.Max(a, 0);
b = Math.Max(b, 0);
c = Math.Max(c, 0);
d = Math.Max(d, 0);
a = Math.Min(a, 2.375);
b = Math.Min(b, 2.375);
c = Math.Min(c, 2.375);
d = Math.Min(d, 2.375);
var rating = (((a + b + c + d) / 6) * 100);
model.QBR = Math.Round(rating, 1);
var result = model.QBR.ToString();
ViewBag.result = $"The NFL QB Rating is: {result}";
}
else
{
//The NCAA doesn't have a minimum or maximum limit,
var rating = (((8.4 * model.yds) + (330 * model.td) + (100 * model.comp) - (200 * model.inter)) / model.att);
model.QBR = Math.Round(rating, 1);
var result = model.QBR.ToString();
ViewBag.result = $"The NCAA QB Rating is: {result}";
}