Tally: count categories with percents and cumulative percents
A tally counts how many times each distinct value appears in a column. For each category it can show the count, the cumulative count, the percent and the cumulative percent. It is the descriptive statistics of categorical data: defect types, reason codes, shifts, suppliers, or small whole numbers such as defects per unit. It involves no test, but it is often the first step before a Pareto chart, a chi-square goodness-of-fit test or a cross tabulation.
When to use it
- You have a column of categories (text codes or numbers) and need to know how often each occurs.
- You want to check data entry: a tally lists every distinct spelling, so typos and inconsistent codes show up at once.
- You need counts and percents for a report, or the input for a Pareto chart or a bar chart.
- You want the distribution of a discrete count, such as the number of flaws per roll, before fitting a model.
How it works
For a column with N non-missing values, sort the distinct values in order (alphabetical for text, numeric for numbers) and for each value v:
- Count: the number of rows equal to v.
- Cumulative count: the running total of the counts down to v.
- Percent: 100 × count / N.
- Cumulative percent: 100 × cumulative count / N.
Percentₖ = 100 · countₖ / N, Cumulative percentₖ = 100 · (count₁ + … + countₖ) / NMissing values (shown as *) are counted separately and left out of N, so the percents describe the rows that have a value. If you want the share of all rows, including missing ones, divide by the total number of rows instead.
A tally of several columns gives one table per column. To count combinations of two variables, such as defect type by shift, use a cross tabulation.
Example
A maker of cordless handheld vacuum cleaners logs every unit returned under warranty with a reason code. The quality engineer wants to know where to focus. The return log for one quarter has 66 rows.
The first tally exposes a data problem: alongside 19 rows of "Battery not charging" there are 2 rows of "battery not charging" in lower case, which the tally counts as a separate category. After merging the two spellings with recode values, the tally reads:
| Reason | Count | CumCnt | Percent | CumPct |
|---|---|---|---|---|
| Battery not charging | 21 | 21 | 32.81 | 32.81 |
| Broken latch | 9 | 30 | 14.06 | 46.88 |
| Cosmetic damage | 8 | 38 | 12.50 | 59.38 |
| Missing parts | 4 | 42 | 6.25 | 65.63 |
| Motor noise | 12 | 54 | 18.75 | 84.38 |
| No fault found | 7 | 61 | 10.94 | 95.31 |
| Other | 3 | 64 | 4.69 | 100.00 |
| N = 64 | N* = 2 |
Two returns have no reason recorded (N* = 2), so the percents are of the 64 returns with a reason.
In alphabetical order, the cumulative columns are only a running total. Sorting the same counts from largest to smallest gives the order a Pareto chart uses, and then the cumulative percent becomes meaningful: the top two reasons, battery and motor noise, account for 51.56% of returns, and the top three for 65.63%.
How to read the results
- Start with N* and the list of categories. Unexpected categories, near-duplicate spellings and many missing values are data-quality problems to fix before any analysis.
- The biggest count is the first target. One third of all returns are battery complaints. That is where root-cause work pays off most: check the charger, the battery pack supplier and the charging circuit.
- "No fault found" is a category to watch. 7 units (10.9%) came back with no confirmed defect. These often point to unclear instructions or a test that does not reproduce the customer's use, and they cost as much to handle as real failures.
- Counts are not costs. A broken latch is cheap to fix; a battery replacement is not. Weight the tally by cost per return when you decide priorities.
- Compare periods carefully. If next quarter shows 15 battery returns, that is a drop only if the number of units in the field stayed similar. Convert to rates for comparisons over time.
Common mistakes
- Trusting the categories as typed. Case, extra spaces and synonyms ("noisy motor", "motor noise") split one category into several. Tally first, then recode.
- Reading cumulative percent in alphabetical order. It only means something when the categories are sorted by count, as in a Pareto chart, or have a natural order, as with numeric counts.
- Forgetting the missing values. Two missing reasons out of 66 is minor; twenty would change the picture. Report N* with the tally.
- Letting "Other" grow. When "Other" becomes one of the larger categories, split it into real codes.
Frequently asked questions
What is the difference between a tally and a Pareto chart?
A tally is the table of counts and percents in category order. A Pareto chart sorts the same counts from largest to smallest, draws them as bars and adds a cumulative percent line, so the few biggest categories stand out.
Can I tally a numeric column?
Yes. Each distinct number becomes a category, which is useful for small counts such as defects per unit or the number of attempts. For continuous measurements, a histogram is more useful, since almost every value is distinct.
Are missing values included in the percents?
Not in the percents described here: they are divided by N, the number of non-missing values, and the missing count is reported as N*. State which base you use when you report percents.
How do I test whether the counts match expected proportions?
Use the chi-square goodness-of-fit test. It compares the tallied counts with the counts expected from equal or historical proportions.