How to Calculate Net Run Rate

Net Run Rate (NRR) Calculator

Net Run Rate (NRR) is a crucial statistic in cricket that measures a team's performance over a series or tournament. It is calculated by subtracting a team's average runs conceded per wicket from its average runs scored per wicket, and then multiplying the result by the number of overs played. A positive NRR indicates that the team is scoring runs faster than their opponents are conceding them, while a negative NRR suggests the opposite.

function calculateNRR() { var totalRunsScored = parseFloat(document.getElementById("totalRunsScored").value); var totalWicketsLost = parseFloat(document.getElementById("totalWicketsLost").value); var totalBallsBowled = parseFloat(document.getElementById("totalBallsBowled").value); var totalRunsConceded = parseFloat(document.getElementById("totalRunsConceded").value); var totalWicketsTaken = parseFloat(document.getElementById("totalWicketsTaken").value); var totalBallsPlayed = parseFloat(document.getElementById("totalBallsPlayed").value); var resultDiv = document.getElementById("result"); resultDiv.innerHTML = ""; // Clear previous results // Input validation if (isNaN(totalRunsScored) || isNaN(totalWicketsLost) || isNaN(totalBallsBowled) || isNaN(totalRunsConceded) || isNaN(totalWicketsTaken) || isNaN(totalBallsPlayed)) { resultDiv.innerHTML = "Please enter valid numbers for all fields."; return; } if (totalWicketsLost === 0 || totalBallsBowled === 0 || totalWicketsTaken === 0 || totalBallsPlayed === 0) { resultDiv.innerHTML = "Wickets lost, wickets taken, and balls played/bowled cannot be zero for calculation."; return; } // Calculate runs scored per wicket var runsScoredPerWicket = totalRunsScored / totalWicketsLost; // Calculate runs conceded per wicket var runsConcededPerWicket = totalRunsConceded / totalWicketsTaken; // Calculate NRR var nrr = (runsScoredPerWicket – runsConcededPerWicket) * (totalBallsPlayed / 6); // Assuming 6 balls per over for simplicity, adjust if T20 specific or other formats needed resultDiv.innerHTML = "

Net Run Rate (NRR)

" + "Runs Scored per Wicket: " + runsScoredPerWicket.toFixed(2) + "" + "Runs Conceded per Wicket: " + runsConcededPerWicket.toFixed(2) + "" + "Your Team's NRR: " + nrr.toFixed(3) + ""; } .input-group { margin-bottom: 15px; } .input-group label { display: inline-block; width: 200px; margin-right: 10px; } .input-group input { padding: 5px; width: 100px; } button { padding: 10px 15px; background-color: #4CAF50; color: white; border: none; cursor: pointer; } button:hover { background-color: #45a049; } #result { margin-top: 20px; padding: 15px; border: 1px solid #ccc; background-color: #f9f9f9; }

Leave a Comment