body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
color: #333;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #f4f6f8;
}
.calculator-container {
background: #ffffff;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
margin-bottom: 40px;
border: 1px solid #e1e4e8;
}
.calculator-header {
text-align: center;
margin-bottom: 25px;
}
.calculator-header h2 {
margin: 0;
color: #2c3e50;
font-size: 24px;
}
.input-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin-bottom: 20px;
}
.input-group {
margin-bottom: 15px;
}
.input-group label {
display: block;
margin-bottom: 8px;
font-weight: 600;
font-size: 14px;
color: #4a5568;
}
.input-group input {
width: 100%;
padding: 12px;
border: 2px solid #e2e8f0;
border-radius: 8px;
font-size: 16px;
transition: border-color 0.2s;
box-sizing: border-box;
}
.input-group input:focus {
border-color: #3182ce;
outline: none;
}
.helper-text {
font-size: 12px;
color: #718096;
margin-top: 4px;
}
.section-title {
grid-column: 1 / -1;
font-size: 16px;
font-weight: 700;
color: #2d3748;
border-bottom: 2px solid #edf2f7;
padding-bottom: 10px;
margin-bottom: 15px;
margin-top: 10px;
}
button.calc-btn {
width: 100%;
background-color: #3182ce;
color: white;
border: none;
padding: 15px;
border-radius: 8px;
font-size: 18px;
font-weight: 600;
cursor: pointer;
transition: background-color 0.2s;
}
button.calc-btn:hover {
background-color: #2c5282;
}
#result-area {
margin-top: 25px;
padding: 20px;
background-color: #ebf8ff;
border-radius: 8px;
border-left: 5px solid #3182ce;
display: none;
}
.result-row {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
font-size: 15px;
}
.final-result {
margin-top: 15px;
padding-top: 15px;
border-top: 1px solid #bee3f8;
font-size: 24px;
font-weight: 800;
text-align: center;
color: #2b6cb0;
}
.content-article {
background: #fff;
padding: 30px;
border-radius: 12px;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.content-article h2 {
color: #2d3748;
margin-top: 30px;
}
.content-article h3 {
color: #4a5568;
}
.excel-code {
background: #f7fafc;
padding: 15px;
border-radius: 6px;
font-family: monospace;
border: 1px solid #e2e8f0;
overflow-x: auto;
}
.warning-box {
background-color: #fffaf0;
border-left: 4px solid #ed8936;
padding: 15px;
margin: 20px 0;
}
@media (max-width: 600px) {
.input-grid {
grid-template-columns: 1fr;
}
}
How to Calculate Net Run Rate in Excel
Net Run Rate (NRR) is the preferred method for breaking ties in cricket tournaments like the World Cup, IPL, or local leagues. While the online calculator above provides instant results, managing a full tournament table usually requires Microsoft Excel or Google Sheets.
The mathematical challenge with calculating NRR in Excel is that cricket overs are denoted in a base-6 format (e.g., 0.1 to 0.5, then 1.0), whereas standard division uses a base-10 decimal system.
The Formula Breakdown
The core logic for NRR is:
NRR = (Total Runs Scored ÷ Total Overs Faced) – (Total Runs Conceded ÷ Total Overs Bowled)
Step-by-Step Excel Implementation
To build this in Excel, you cannot simply divide runs by the "Overs" column because Excel sees "10.3" as "10 and 3/10ths", whereas in cricket, it represents "10 and 3/6ths".
1. Setup Your Columns
- A2: Runs Scored
- B2: Overs Faced (e.g., 19.4)
- C2: Runs Conceded
- D2: Overs Bowled (e.g., 20.0)
2. The Conversion Formula
You need to convert the cricket notation (19.4) into a mathematical decimal (19.666). Use this formula to convert Overs:
=INT(B2) + (MOD(B2,1)*10)/6
Explanation: INT(B2) takes the completed overs. MOD(B2,1) isolates the decimal (.4). Multiplying by 10 makes it an integer (4), and dividing by 6 converts balls to a fraction of an over.
3. The Final NRR Formula
Combine everything into one cell to get the Net Run Rate:
=(A2 / (INT(B2) + (MOD(B2,1)*10)/6)) – (C2 / (INT(D2) + (MOD(D2,1)*10)/6))
Important NRR Rules
The "All Out" Rule: If a team is bowled out (e.g., for 140 in 18.2 overs) in a 20-over match, you MUST use the full quota of overs (20.0) for the calculation, not the actual overs batted (18.2). However, if a team chases down a target, you use the actual overs taken.
Example Calculation
Scenario: Team A scores 180 runs in 20 overs. They bowl out the opposition for 150 in 19.3 overs.
- Team A Batting: 180 / 20 = 9.0 Run Rate
- Team A Bowling: Since they bowled the opposition out, runs conceded is 150, but overs bowled counts as the balls actually bowled (19.5 mathematical). Note: In some tournaments, if the opposition is all out, the bowling team is credited with full overs. Always check specific league rules. Standard NRR usually counts runs/overs strictly.
- Standard NRR Logic: NRR = 9.0 – (150 / 19.5) = 9.0 – 7.69 = +1.31
function calculateNRR() {
// 1. Get Elements
var runsScoredInput = document.getElementById("runsScored");
var oversFacedInput = document.getElementById("oversFaced");
var runsConcededInput = document.getElementById("runsConceded");
var oversBowledInput = document.getElementById("oversBowled");
var resultArea = document.getElementById("result-area");
var displayRPOFor = document.getElementById("displayRPOFor");
var displayRPOAgainst = document.getElementById("displayRPOAgainst");
var displayNRR = document.getElementById("displayNRR");
// 2. Parse Inputs
var runsScored = parseFloat(runsScoredInput.value);
var oversFacedStr = oversFacedInput.value;
var runsConceded = parseFloat(runsConcededInput.value);
var oversBowledStr = oversBowledInput.value;
// 3. Validation
if (isNaN(runsScored) || !oversFacedStr || isNaN(runsConceded) || !oversBowledStr) {
alert("Please fill in all fields with valid numbers.");
return;
}
// 4. Helper Function: Convert Cricket Overs (Over.Ball) to Decimal
function convertOvers(overStr) {
var val = parseFloat(overStr);
var overs = Math.floor(val);
// Handle floating point precision issues for the decimal part
// e.g., 19.4 -> 0.4
var ballsDecimal = Math.round((val – overs) * 10);
// Validation: Balls cannot be >= 6
if (ballsDecimal >= 6) {
// Determine if this is a user error or just bad input formatting
// For this calculator, we will just process it, but ideally, 0.6 is invalid in cricket notation
}
var realOvers = overs + (ballsDecimal / 6);
return realOvers;
}
var realOversFaced = convertOvers(oversFacedStr);
var realOversBowled = convertOvers(oversBowledStr);
// Prevent division by zero
if (realOversFaced === 0 || realOversBowled === 0) {
alert("Overs faced or bowled cannot be zero.");
return;
}
// 5. Calculation Logic
var runRateFor = runsScored / realOversFaced;
var runRateAgainst = runsConceded / realOversBowled;
var nrr = runRateFor – runRateAgainst;
// 6. Display Results
displayRPOFor.innerHTML = runRateFor.toFixed(4);
displayRPOAgainst.innerHTML = runRateAgainst.toFixed(4);
var nrrFormatted = nrr.toFixed(3);
if (nrr > 0) {
nrrFormatted = "+" + nrrFormatted;
displayNRR.style.color = "#276749"; // Green
} else {
displayNRR.style.color = "#c53030"; // Red
}
displayNRR.innerHTML = nrrFormatted;
resultArea.style.display = "block";
}