function calculateNRR() {
// Get input values
var runsScored = document.getElementById('runsScored').value;
var oversFaced = document.getElementById('oversFaced').value;
var runsConceded = document.getElementById('runsConceded').value;
var oversBowled = document.getElementById('oversBowled').value;
// Validate inputs
if (runsScored === " || oversFaced === " || runsConceded === " || oversBowled === ") {
alert("Please fill in all fields to calculate NRR.");
return;
}
runsScored = parseFloat(runsScored);
oversFaced = parseFloat(oversFaced);
runsConceded = parseFloat(runsConceded);
oversBowled = parseFloat(oversBowled);
if (isNaN(runsScored) || isNaN(oversFaced) || isNaN(runsConceded) || isNaN(oversBowled)) {
alert("Please enter valid numbers.");
return;
}
// Helper function to convert cricket overs (10.4) to decimal overs (10.666)
function convertOversToDecimal(oversInput) {
var wholeOvers = Math.floor(oversInput);
var balls = Math.round((oversInput – wholeOvers) * 10);
// Validate balls (cannot be 6 or more in input like 10.6)
if (balls >= 6) {
// This is a rough handle, ideally alert user, but we will treat as extra over
wholeOvers += Math.floor(balls / 6);
balls = balls % 6;
}
return wholeOvers + (balls / 6);
}
var oversFacedDecimal = convertOversToDecimal(oversFaced);
var oversBowledDecimal = convertOversToDecimal(oversBowled);
// Avoid division by zero
if (oversFacedDecimal === 0 || oversBowledDecimal === 0) {
alert("Overs cannot be zero.");
return;
}
// Calculate Run Rates
var runRateFor = runsScored / oversFacedDecimal;
var runRateAgainst = runsConceded / oversBowledDecimal;
// Calculate NRR
var nrr = runRateFor – runRateAgainst;
// Display Results
var resultBox = document.getElementById('result');
var nrrDisplay = document.getElementById('nrrValue');
var rpoForDisplay = document.getElementById('rpoFor');
var rpoAgainstDisplay = document.getElementById('rpoAgainst');
resultBox.style.display = 'block';
// Format NRR string with + sign if positive
var nrrFormatted = nrr.toFixed(3);
if (nrr > 0) {
nrrFormatted = "+" + nrrFormatted;
nrrDisplay.className = "result-value result-positive";
} else if (nrr < 0) {
nrrDisplay.className = "result-value result-negative";
} else {
nrrDisplay.className = "result-value";
}
nrrDisplay.innerHTML = nrrFormatted;
rpoForDisplay.innerHTML = runRateFor.toFixed(3);
rpoAgainstDisplay.innerHTML = runRateAgainst.toFixed(3);
}
How to Use the CricClubs Net Run Rate Calculator
Net Run Rate (NRR) is the standard method used by CricClubs and major cricket boards (ICC, BCCI) to rank teams with equal points in limited-overs tournaments. Whether you are managing a local league on CricClubs or analyzing T20 statistics, understanding NRR is crucial for determining semi-final qualifications.
What is Net Run Rate?
Net Run Rate is essentially a comparison of a team's scoring rate against their conceding rate. It represents the average excess runs scored per over compared to the opponent.
Formula:
NRR = (Total Runs Scored ÷ Total Overs Faced) – (Total Runs Conceded ÷ Total Overs Bowled)
Important Calculation Rules
To get an accurate result matching the CricClubs system, you must adhere to specific rules regarding "All Out" scenarios:
The "All Out" Rule: If a team is bowled out (loses all 10 wickets) before completing their full quota of overs (e.g., in 18.2 overs in a T20), the calculation considers them to have faced the full quota (20.0 overs), not the actual overs played.
Winning Team Chasing: If a team chases down a target (e.g., reaching the target in 15.4 overs), the actual overs faced (15.4) are used in the calculation.
Ball Conversion: Cricket overs are not standard decimals. An input of 10.3 represents 10 overs and 3 balls (which is 10.5 in standard decimal math). This calculator automatically handles this conversion for you.
Example Calculation
Imagine Team A plays two matches in a tournament:
Match 1: Scores 160/6 in 20 overs. Concedes 140/9 in 20 overs.
Match 2: Scores 150 All Out in 18 overs (treated as 20 overs). Concedes 130/8 in 20 overs.
Total Runs Scored: 160 + 150 = 310 Total Overs Faced: 20.0 + 20.0 (due to all out) = 40.0 Total Runs Conceded: 140 + 130 = 270 Total Overs Bowled: 20.0 + 20.0 = 40.0