Mean, Median & Mode Calculator with a What-If Test

Paste individual measurements or exact value/count rows. Read the original mean, median and most frequent values, then compare a scenario that adds or replaces one observation. Inspect the sorted ranks and frequency changes, or solve for the value that would produce an entered target mean.

Summary statistics and one-value scenarios

Compare mean, median and mode after a change

Enter data, test one added or replaced observation, and see which measures of center move.

The median stays the same.

Original data

7 observations · 5 distinct

Mean
14.285714
Median
10
Rank 4
Mode
9, 10
2 occurrences each

One-value scenario

7 observations · 5 distinct

Mean
10.142857
Median
10
Rank 4
Mode
9, 10
2 occurrences each

Mean and median before and after

Dots mark the mean and diamonds mark the median. The lower line is the scenario when it is available.

Minimum 8Maximum 40

Edit the entered data

Separate up to 240 values with commas or spaces.

Edit the one-value scenario

Proposed value to reach the target mean: 10.

Open frequency and rank ledger

Original median uses rank 4 (10). Scenario median uses rank 4 (10).

Frequency of each value before and after the proposed change
ValueOriginal countScenario count
811
922
1022
1101
1411
4010
Open selectable CSV

How to use this calculator

  1. Enter individual values separated by commas or spaces, or paste exact value,count rows.
  2. Read the original mean, median and modes. Open the ledger to see which middle ranks set the median.
  3. Choose whether to add one observation or replace one occurrence, then enter the proposed value.
  4. Compare the original and revised center markers. Optionally enter a target mean and apply the exact solution.
  5. Download the frequency, rank and location summaries as CSV.

The Formula

The mathematical logic powering this calculation is:

Let n be the number of observations and S their sum. Each count f for an exact value v contributes f observations and f × v to the sum. The mean is S/n. For odd n the median is the value at rank (n + 1)/2. For even n it averages the values at ranks n/2 and n/2 + 1. Find these ranks from cumulative counts without expanding the table. A mode is a value with the greatest repeated count. Report all ties at that count. If every value occurs once, report no repeated value.

Adding one value x changes the count to n + 1 and the sum to S + x. Replacing one occurrence of value y with x keeps n and changes the sum to S − y + x. The calculator recomputes the median and modes from the updated frequencies. Your pasted data remain intact.

For a target mean m, an addition must be x = m(n + 1) − S. A replacement must be x = mn − S + y. Applying the suggested value updates only the scenario. An out-of-range solution is reported separately from the entered result.

Enter up to 240 individual observations or 160 exact value/count rows with up to 160 distinct values. Frequency totals can be at most 1 billion. Exact values can be within ±1 trillion, with up to six decimal places. Exact decimal inputs, weighted sums and median ranks are retained. The display rounds to six places. The frequency rows describe individual values, rather than bins or weights. The scenario shows sensitivity to one value and does not establish whether a data correction is warranted.

Worked Example

If you input:

  • Values: 8, 9, 9, 10, 10, 14, 40
  • Scenario: Replace one occurrence of 40 with 11
  • Target mean: 10

Result:

The mean changes from 14.285714 to 10.142857. The median stays 10 and 9 and 10 remain tied modes. Replacing 40 with 10 would reach the target mean of 10.

Frequently Asked Questions

How do I calculate mean, median and mode?

Divide the sum by the observation count for the mean. Use the middle sorted rank or the average of the two middle ranks for the median. Find the most frequently repeated values for the modes.

Can more than one value be a mode?

Yes. If several values share the greatest count and that count exceeds one, they are tied modes. The ledger and CSV retain every tied value.

Can I enter a histogram with intervals?

This input needs each exact value, even if it appears many times. A histogram interval generally does not identify the exact values inside it. Use the relative frequency tool for interval counts.

Why can one value move the mean but leave the median in place?

The mean uses every observation in the sum. The median uses the positions of the middle observation or pair. A change far from those middle ranks can affect only the sum.

Does a suggested target value edit the data I pasted?

It replaces the proposed value in the scenario. Both the original data and their results remain available.

Similar Calculators