How to Calculate a Ratio in Excel
By ExcelReady TeamUpdated 7 min read
The short answer
To calculate a ratio in Excel, divide the first number by the second: =B2/C2 returns 20 when 240 students share 12 teachers. To show it as a ratio, join the result to text: =ROUND(B2/C2,1)&":1" displays 20:1. For a simplified whole-number ratio such as 16:9, divide both numbers by their GCD.
Key takeaways
- A ratio is one number divided by another: =B2/C2.
- =ROUND(B2/C2,1)&":1" shows the ratio as text, such as 22.5:1.
- =B2/GCD(B2,C2)&":"&C2/GCD(B2,C2) simplifies a ratio to whole numbers, such as 45:2 or 16:9.
- Keep the plain division in its own column if you need to sort or chart the ratios, because the ":1" versions are text.
- Wrap the division in IFERROR, or test for zero, so a missing value doesn't show #DIV/0!.
On this page+
To calculate a ratio in Excel, you divide one number by the other, then decide how to show it: as a plain number (20), as text in the familiar style (20:1), or as a simplified whole-number ratio (16:9). Excel has no RATIO function, but division, ROUND, the & operator and GCD cover every case. This guide is for anyone comparing two numbers, such as students per teacher, wins to losses or debt to income.
What is a ratio in Excel?#
A ratio compares two numbers by showing how many times one fits into the other. "20 to 1" means there are 20 of the first for every 1 of the second. In Excel, a ratio is just a division, plus some formatting if you want it to look like 20:1.
All the examples below use this table of schools in A1:C6:
| A | B | C | |
|---|---|---|---|
| 1 | School | Students | Teachers |
| 2 | Oak | 240 | 12 |
| 3 | Elm | 180 | 15 |
| 4 | Pine | 315 | 14 |
| 5 | Ash | 96 | 8 |
| 6 | Birch | 210 | 9 |
How to calculate a ratio with simple division#
The simplest ratio is the first number divided by the second. In D2, type:
=B2/C2The result is 20: Oak has 20 students per teacher. Fill the formula down to D6 (Windows: Ctrl+D; Mac: ⌘D) to get 12, 22.5, 12 and 23.333… for the other schools.
This plain number is the most useful form for analysis. You can sort it, chart it, average it and compare it with a target. The order matters: =C2/B2 gives the opposite ratio, 0.05 teachers per student. Put the thing you are counting "per" second. If you're new to typing formulas like this, the first formulas lesson walks through it.
How to show a ratio as 20:1#
To display a ratio in the A:1 style, join the result of the division to the text ":1" with the & operator. Round it first so you don't get long decimals:
=ROUND(B2/C2,1)&":1"| School | Formula | Result |
|---|---|---|
| Oak | =ROUND(B2/C2,1)&":1" | 20:1 |
| Elm | =ROUND(B3/C3,1)&":1" | 12:1 |
| Pine | =ROUND(B4/C4,1)&":1" | 22.5:1 |
| Birch | =ROUND(B6/C6,1)&":1" | 23.3:1 |
To put the 1 first, reverse it: ="1:"&ROUND(B2/C2,1) returns 1:20.
The result is text, not a number. It looks right, but you can't sum, average or chart it, and sorting goes by character, not by value, so "9:1" lands after "20:1". Keep the plain division in one column and the display version in another.
How to calculate a simplified ratio with GCD#
To show a ratio as two whole numbers, such as 45:2, divide both numbers by their greatest common divisor (GCD), the largest whole number that divides both evenly:
=B4/GCD(B4,C4)&":"&C4/GCD(B4,C4)For Pine, GCD(315,14) is 7, so the result is 45:2 (315 ÷ 7 = 45 and 14 ÷ 7 = 2). For Oak it is 20:1, and for Birch 70:3.
This is the method for screen sizes and mixing ratios. A screen of 1920 by 1080 pixels gives GCD 120, so the formula returns 16:9. GCD only works with whole numbers: it drops anything after the decimal point, so 2.5 is treated as 2. Multiply decimals up to whole numbers first (for example, by 10) before you use it.
How to round a ratio#
Use ROUND when the number of decimals matters to the result, and number formatting when it only matters to the look. =ROUND(B6/C6,1) stores 23.3. Formatting =B6/C6 to one decimal also shows 23.3, but Excel keeps 23.333… underneath, which changes later sums.
=ROUND(number, num_digits)num_digits is how many decimals to keep: 1 gives 23.3, 0 gives 23 and 2 gives 23.33. ROUNDUP and ROUNDDOWN always round in one direction, which helps when a ratio is a limit, such as "no more than 23 students per teacher". The ROUND function guide has more examples.
How to show a ratio as a percentage#
A percentage compares a part with the whole, so divide by the total, not by the other part. A team with 45 wins and 15 losses has a win-to-loss ratio of 3:1, but a win rate of:
=45/(45+15)That returns 0.75. Apply the Percent format (Home > %, or Ctrl+Shift+% on Windows and ⌃⇧% on a Mac) to show 75%. Mixing these two up is a common mistake: 45/15 = 3 is a ratio, not 300% of anything useful. Percentages, ratios and discounts all come down to the same division; see how to calculate a discount in Excel and how to calculate tax in Excel for related formulas.
How to compare ratios with a target or a total#
Once the ratio is a plain number, you can test it like any other value. To flag schools with more than 20 students per teacher:
=IF(B2/C2>20,"Over","OK")Filled down, this returns Over for Pine (22.5) and Birch (23.3), and OK for the rest. Oak is exactly 20, so it is not over.
For an overall ratio across all schools, divide the totals. Don't average the separate ratios:
=SUM(B2:B6)/SUM(C2:C6)This returns 17.9 when rounded (1,041 students ÷ 58 teachers). =AVERAGE(D2:D6) on the five ratios gives 18.0, because it treats a small school the same as a large one. Here the gap is small, but it grows when the groups are very different in size. The sum-divided-by-sum version is the true overall ratio.
How to avoid #DIV/0! in a ratio#
If the second number is zero or the cell is empty, the division returns #DIV/0!. Catch it with IFERROR:
=IFERROR(B2/C2,"")This shows a blank instead of the error. To be stricter, test for zero yourself, so other errors (such as text in the cell) still show:
=IF(C2=0,"",B2/C2)Use one of these whenever ratios feed a report or an invoice. Error values in one cell spread to every total that uses it; the invoice with formulas guide shows the same habit for line totals.
Practise it#
Try the exercise on this page: it combines division, ROUND and & in one formula. Then practise ROUND, ROUNDUP and ROUNDDOWN in a live spreadsheet to control decimals properly, and go back to the first formulas lesson if division and cell references still feel new. Each step is checked as soon as you press Enter.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Show Pine school's student-to-teacher ratio as text. In D4, divide B4 by C4, round it to 1 decimal place and join ":1" to the end.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Ratio | ||||
| 2 | |||||
| 3 | |||||
| 4 | |||||
| 5 | |||||
| 6 | |||||
| 7 | |||||
| 8 | |||||
| 9 |
Tip: Put B4/C4 inside ROUND with 1 decimal, then add &":1" after the closing bracket.
Practise this in a lesson
Frequently asked questions
What is the formula for a ratio in Excel?
Divide one number by the other, such as =B2/C2. To display it in the A:B style, use =ROUND(B2/C2,1)&":1" or simplify both numbers with GCD.
How do I show a ratio like 3:1 in Excel?
Join the rounded division to the text ":1" with the ampersand: =ROUND(B2/C2,1)&":1". The result is text, so keep the plain number in another column if you need to sort or chart it.
How do I simplify a ratio in Excel?
Divide both numbers by their greatest common divisor: =B2/GCD(B2,C2)&":"&C2/GCD(B2,C2). For 1920 and 1080 this returns 16:9. GCD works only with whole numbers.
How do I turn a ratio into a percentage in Excel?
Divide the part by the whole, not by the other part. For 45 wins and 15 losses, =45/(45+15) returns 0.75, which shows as 75% with the Percent format.
Why does my ratio formula show #DIV/0!?
The number you divide by is zero or the cell is empty. Use =IFERROR(B2/C2,"") or =IF(C2=0,"",B2/C2) to show a blank instead.