The formula
The formula is: (part divided by whole) times 100. The part is the number you are measuring; the whole is the number you are measuring it against. Get those two roles right and the arithmetic is trivial.
Step by step with 23 out of 40: divide 23 by 40 to get 0.575. Multiply by 100 to get 57.5 percent. Two steps, one answer.
Getting the order right
The single most common error is dividing in the wrong order. "What percent of 40 is 23?" means 23 is the part and 40 is the whole: 23 divided by 40 equals 57.5 percent. "What percent of 23 is 40?" is a different question: 40 divided by 23 equals 173.9 percent, because 40 is larger than 23.
A plain-English check: read the question and find the word "of." The number after "of" is almost always the whole, the denominator. In "what percent of 200 is 50," the 200 after "of" goes on the bottom: 50 divided by 200 equals 25 percent.
Worked examples
Example 1, a test score: 42 out of 50. Divide 42 by 50 to get 0.84. Times 100 gives 84 percent.
Example 2, a sales target: a rep closed 34 of a 50-deal quota. Divide 34 by 50 to get 0.68. Times 100 gives 68 percent of quota.
Example 3, a budget: 68 dollars spent of an 85 dollar grocery budget. Divide 68 by 85 to get 0.80. Times 100 gives 80 percent of the budget used.
Example 4, a survey: 1,275 of 1,500 respondents agreed. Divide 1,275 by 1,500 to get 0.85. Times 100 gives 85 percent agreement.
Example 5, an over-100 result: 60 out of 40 tasks completed early in a quarter where the stretch goal was 40. Divide 60 by 40 to get 1.5. Times 100 gives 150 percent. Percentages above 100 simply mean the part exceeded the whole, which is normal for stretch goals and growth measures.
Decimals, fractions, and rounding
Keep two to three decimal places in the division step and round once at the end. For 7 out of 13: 7 divided by 13 is 0.5385, times 100 gives 53.8 percent (or 54 percent if you are rounding to whole numbers). For 5 out of 6: 5 divided by 6 is 0.8333, times 100 gives 83.3 percent.
If your inputs are fractions, convert to decimals first. Three quarters of 200 scored at or above the bar: 0.75 times 200 is 150, and 150 divided by 200 times 100 is 75 percent. And if you need the reverse problem, starting from a percent to find the amount, see our guide on how to calculate the percentage of a number.
Using this in spreadsheets
In Excel or Google Sheets, the formula is =A1/B1 with the cell formatted as a percentage, or =(A1/B1)*100 as a plain number. Put the part in A1 and the whole in B1. Formatting the cell as a percentage handles the times-100 step automatically, which is one less place to make an error.