How to Find Relative Frequency in Excel: Formulas, FREQUENCY and PivotTables

To find relative frequency in Excel, count how often each value appears, then divide each count by the total. With your categories listed in D2:D6, enter =COUNTIF($A$2:$A$21,D2) in E2 to count each one, put the total in E7 with =SUM(E2:E6), and enter =E2/$E$7 in F2. Copy the formulas down, then select the results and choose Home > Percent Style to show them as percentages. Once you have relative frequencies, you can use them as probabilities to calculate expected value in Excel.

Relative frequency is the share of all observations that fall into one group. It is a proportion between 0 and 1, and all the relative frequencies in a table add up to 1 (100%). This guide shows the formula method for text categories, the FREQUENCY function for numbers grouped into ranges, a PivotTable method that needs no formulas, cumulative relative frequency, and how to chart the results.

Which method do you need?

Your dataBest methodWhat you get
Text categories (survey answers, product names)COUNTIF and divide by the totalA live table that updates when data changes
Numbers you want grouped into ranges (scores, ages)FREQUENCY or COUNTIFSCounts and relative frequency per range
A large table you don’t want to write formulas forPivotTable with % of Grand TotalCounts and percentages in a few clicks
You want a running shareRunning SUM or % Running Total InCumulative relative frequency

Method 1: Relative frequency for categories with COUNTIF

This example uses 20 survey answers about favorite fruit, typed in A2:A21. The answers are Apple (7 times), Banana (5), Cherry (4), Grape (3) and Mango (1).

  1. List each category once. Type the unique values in D2:D6. In Microsoft 365 or Excel 2021 and later, =UNIQUE(A2:A21) in D2 lists them for you. In older versions, copy column A and use Data > Remove Duplicates on the copy. Your data does not need to be sorted.
  2. Count each category. In E2, enter =COUNTIF($A$2:$A$21,D2) and copy it down to E6. The COUNTIF function counts the cells in a range that match one criterion.
  3. Get the total. In E7, enter =SUM(E2:E6). You can also count the original answers with =COUNTA(A2:A21). Use COUNTA, not COUNT, for text: COUNT only counts numbers, so it returns 0 for a list of fruit names. Both give 20 here.
  4. Divide each count by the total. In F2, enter =E2/$E$7 and copy it down. The dollar signs lock the reference to the total so it doesn’t shift as you copy.
  5. Format as percentages. Select F2:F6 and choose Home > Percent Style, or press Ctrl + Shift + %.
Excel worksheet calculating relative frequency with COUNTIF
Divide each count by the total for relative frequency.

Your finished table looks like this:

Fruit (D)Frequency (E)Relative frequency (F)As a percent
Apple70.3535%
Banana50.2525%
Cherry40.2020%
Grape30.1515%
Mango10.055%
Total201.00100%

Add =SUM(F2:F6) in F7 as a check. It should show 1, or 100% once formatted.

Formatting: don’t multiply by 100

Keep the formula as a plain division and let the format do the rest. Microsoft’s guide to formatting numbers as percentages explains that Excel multiplies existing numbers by 100 when you apply Percentage format, so 0.35 shows as 35%. If you write =E2/$E$7*100 and then apply Percentage, you get 3500%.

To control decimal places, open the Number dialog box launcher on the Home tab (on a Mac, use the Number Format box > More Number Formats), choose the Percentage category and set Decimal places.

Method 2: Grouped numbers with FREQUENCY

For numbers such as test scores, you usually group values into ranges (bins) first. If you’re not sure how to choose ranges, see how to create bins in Excel.

This example has 15 test scores in A2:A16: 52, 58, 61, 65, 67, 70, 72, 74, 78, 81, 83, 85, 88, 92 and 97.

  1. Enter the upper limit of each bin in C2:C5: 59, 69, 79 and 89. Each bin counts values above the previous limit, up to and including its own.
  2. Add labels in B2:B6 so the table is readable: 59 or below, 60 to 69, 70 to 79, 80 to 89, and Over 89.
  3. Enter FREQUENCY. In D2, enter =FREQUENCY(A2:A16,C2:C5).
    • In Microsoft 365 or Excel 2021 and later, press Enter. The results spill into D2:D6 automatically.
    • In older versions, select D2:D6 first, type the formula, and press Ctrl + Shift + Enter.
  4. Divide by the total. In E2, enter =D2/COUNT($A$2:$A$16) and copy it down to E6. COUNT is right here because the scores are numbers. In Microsoft 365 or Excel 2021 and later you can do it in one step with =FREQUENCY(A2:A16,C2:C5)/COUNT(A2:A16).
  5. Apply Percent Style and set two decimal places.

Notice that four bin limits produce five results. Microsoft’s FREQUENCY function page says the returned array has one more element than bins_array; the extra one counts values above the highest bin. If you select only four cells in older Excel, you lose the two scores above 89. FREQUENCY also ignores blank cells and text.

Range (B)Bin (C)Frequency (D)Relative frequency (E)
59 or below59213.33%
60 to 6969320.00%
70 to 7979426.67%
80 to 8989426.67%
Over 89(extra result)213.33%
Total15100.00%

Alternative: COUNTIFS for each range

If you’d rather have one ordinary formula per row, COUNTIFS counts values between a lower and upper limit. For the 60 to 69 range: =COUNTIFS($A$2:$A$16,">59",$A$2:$A$16,"<=69"). Watch the boundaries. If one row uses "<=49" and the next starts at ">=50", a value like 49.5 falls through the gap. Using ">59" instead of ">=60" avoids that for decimal data.

Method 3: PivotTable with % of Grand Total

A PivotTable counts and calculates percentages without any formulas, which helps with long lists.

  1. Click any cell in your data (it needs a header, such as Fruit) and select Insert > PivotTable > OK.
  2. In the field list, drag Fruit to Rows, then drag Fruit again to Values. Excel shows Count of Fruit.
  3. Drag the same field into Values a second time, so you have two count columns.
  4. Right-click a number in the second count column and select Show Values As > % of Grand Total.
Excel PivotTable showing values as % of Grand Total
Count of Fruit2 uses Show Values As → % of Grand Total. The article’s 20 responses give Apple 35%, Banana 25%, Cherry 20%, Grape 15% and Mango 5%; counts and percentages appear side by side. This is a recreated PivotTable, not a changed workbook.

You now see the count and relative frequency side by side. Microsoft’s guide to showing different calculations in PivotTable value fields lists this option, plus % of Column Total and % Running Total In. On a Mac, select More Options if Show Values As isn’t listed.

For numeric data, you can right-click a value in the Rows area and choose Group to set ranges, such as a start, end and step of 10. If Excel refuses to group, the column may contain blanks or text. A PivotTable doesn’t update by itself, so right-click it and choose Refresh after you change the data.

Cumulative relative frequency

Cumulative relative frequency shows the running share up to each row, so the last row is always 100%. Using the fruit table, enter =SUM($F$2:F2) in G2 and copy it down. Only the first cell reference is locked, so the range grows by one row each time.

FruitRelativeCumulative
Apple35%35%
Banana25%60%
Cherry20%80%
Grape15%95%
Mango5%100%

For the test scores, the cumulative values are 13.33%, 33.33%, 60.00%, 86.67% and 100.00%. That tells you, for example, that 60% of students scored 79 or below. In a PivotTable, choose Show Values As > % Running Total In instead.

Chart the relative frequency

Excel’s built-in histogram, at Insert > Insert Statistic Chart > Histogram, plots counts, not relative frequency. Microsoft’s guide to creating a histogram shows how to set the bin width, number of bins and overflow bin by right-clicking the horizontal axis and choosing Format Axis. It’s useful for a quick look at the shape of the data.

To chart relative frequency itself:

  1. Select the label column and the relative frequency column (for example B1:B6 and E1:E6; hold Ctrl to select both).
  2. Select Insert > Insert Column or Bar Chart > Clustered Column.
  3. For a histogram look, right-click a bar, choose Format Data Series, and set Gap Width to 0%.

The Analysis ToolPak add-in also has a Histogram tool that can output a frequency table with a cumulative percentage column. Load it on Windows with File > Options > Add-Ins, choose Excel Add-ins in the Manage box, select Go and tick Analysis ToolPak. On a Mac, use Tools > Excel Add-ins. Then open Data > Data Analysis, as Microsoft’s guide to using the Analysis ToolPak describes. In the Histogram dialog, select Cumulative Percentage to add the running share.

Common problems

  • Percentages show as 3500%. You multiplied by 100 and applied Percentage format. Remove the *100.
  • Every row divides by the wrong cell. The total reference wasn’t locked. Use $E$7, not E7.
  • The total is 0. You used COUNT on text. Switch to COUNTA or SUM the counts.
  • One category is split in two. A stray space makes “Apple ” different from “Apple”. Microsoft’s COUNTIF page suggests TRIM or CLEAN to remove extra spaces and nonprinting characters. COUNTIF isn’t case sensitive, so “apple” and “Apple” are counted together.
  • #SPILL! from FREQUENCY. Something is in the cells below the formula. Clear them so all results (bins plus one) can spill.
  • The total is 99.9% or 100.1%. That’s rounding in the displayed values. The underlying numbers still add to 1.

For a simple measure of spread, see how to calculate mean absolute deviation in Excel.

Questions

Can relative frequency be more than 1?

No. A group can’t contain more than all the observations, so each relative frequency is between 0 and 1, and together they add up to exactly 1.

What’s the difference between frequency and relative frequency?

Frequency is the count, such as 7 people choosing Apple. Relative frequency is that count divided by the total, such as 7 out of 20, or 0.35. It lets you compare groups of different sizes.

Do I need to sort my data first?

No. COUNTIF, FREQUENCY and PivotTables all work on unsorted data. Sorting only makes the table easier to read.

About the author

Matt Williams is the writer and editor behind TechInfoHome. He holds a degree in computer science and has more than 10 years of experience working in IT. More about TechInfoHome.