Table of Contents
The Friedman Test stands as a sophisticated non-parametric alternative to the traditional one-way Repeated Measures ANOVA. This powerful statistical procedure is expertly designed to ascertain whether a statistically significant difference exists among the population medians of three or more related groups. Its application is essential in research where the same subjects or matched items are measured across multiple treatment conditions, making it the definitive choice for studies involving repeated observations or matched samples, particularly when the underlying assumptions required for parametric tests, such as normality, may be violated.
Although specialized statistical software is commonly employed for complex data analysis, the necessary mathematical functions are accessible within Microsoft Excel, allowing for the manual execution of the complete Friedman Test calculation. This comprehensive tutorial provides precise, step-by-step guidance on performing this analysis using standard Excel formulas. By following this methodology, you will ensure the accurate derivation of the test statistic ($Q$) and the corresponding p-value, enabling robust statistical inference directly within your spreadsheet environment.
Example: Applying the Friedman Test in Excel
To demonstrate the efficacy and practical application of the Friedman Test, we will utilize a widely recognized scenario from clinical or pharmaceutical research. Our example involves measuring the reaction time of a cohort of 10 patients following the administration of three distinct pharmaceutical drugs. Since every one of the 10 patients receives all three drugs—a classic within-subjects design—the observations are inherently related, thereby mandating the use of the Friedman Test.
The central objective of this rigorous analysis is to formally determine if the variation in the type of drug administered produces a statistically significant difference in the mean rank reaction time observed across the patient group. We begin by formulating our core hypotheses. We postulate that there may be an effect attributable to the drug type (the alternative hypothesis), which we will test formally against the null hypothesis. The null hypothesis ($H_0$) asserts that the population medians for the reaction times under all three drug conditions are statistically identical, meaning the drugs have no differential effect.
Step 1: Entering and Structuring the Raw Data
The foundation of any sound statistical evaluation relies on the accurate input and appropriate structure of the raw data. For the Friedman Test implemented in Excel, the data must be organized meticulously: each row must represent a single subject (or patient), and each column must correspond to a distinct treatment condition (or drug). This specific matrix structure is essential as it explicitly preserves the paired or related nature of the repeated observations, which is fundamental to the test’s design.
In our clinical example, we input the reaction times (measured in seconds) for 10 patients across three unique treatment groups: Drug 1, Drug 2, and Drug 3. This setup gives us n = 10 subjects and k = 3 treatment groups. The accurate organization of this raw data forms the indispensable foundation for the subsequent non-parametric ranking procedure. Ensure the data aligns exactly as depicted below, setting the stage for the next analytical phase:

Maintaining this clear, organized table is paramount for analytical efficiency, particularly because the core ranking operation in Step 2 must be executed strictly within the confines of each individual patient’s row, comparing their scores across the three different drug conditions.
Step 2: Ranking the Data Values within Each Subject
A defining feature of non-parametric statistics is the substitution of the original, quantitative data values with their relative positional ranks. In the context of the Friedman Test, this ranking process must be carried out independently for every subject (row). This methodological choice effectively maintains the structure of the repeated measures design while simultaneously mitigating detrimental effects caused by data outliers or severe deviations from the normal distribution assumption, issues that frequently complicate parametric procedures like ANOVA.
To execute the ranking within Excel, we must employ the specialized function =RANK.AVG(). This function is critical because it correctly manages any instances of tied scores by assigning the arithmetic average of the ranks that would otherwise have been allocated to those tied values. We begin by calculating the rank for the reaction time of Patient 1 on Drug 1, using Patient 1’s times on Drug 2 and Drug 3 as the comparative reference. The precise formula structure utilized for determining the rank of the first data point is visually demonstrated below, highlighting the necessary cell references for a row-wise ranking:

Once this ranking formula is correctly established for the first subject, it must be efficiently replicated and applied across all subsequent cells, ensuring the ranking process is performed independently for all 10 rows. After successfully applying the RANK.AVG function to the entire dataset, the resulting spreadsheet will exclusively display the calculated ranks for each observation. It is these ranks, and not the original raw scores, that serve as the foundational inputs for the subsequent computation of the test statistic. The completed ranked table is shown below:

The final and equally critical step in data preparation involves aggregating these ranks. We are required to compute the sum of the ranks ($R_j$) for every single treatment column (Drug 1, Drug 2, and Drug 3). Furthermore, we must calculate the squared sum of ranks ($Sigma R_j^2$), as this derived term is an indispensable component of the numerator in the Friedman Test formula. These crucial aggregate values are systematically calculated and displayed at the base of the ranked data table, providing the comprehensive input parameters required for the final statistical computation, as illustrated:

Step 3: Calculating the Test Statistic (Q) and Corresponding P-Value
With the ranked sums ($R_j$) successfully derived in the previous step, we can now proceed to calculate the Friedman Test statistic, denoted as $Q$. This statistic serves as a quantitative measure, reflecting the overall magnitude of the discrepancies observed among the rank sums of the various treatment groups. The mathematical definition of the test statistic $Q$ is explicitly provided by the formula:
Q = 12/nk(k+1) * ΣRj2 – 3n(k+1)
To ensure accuracy in the Excel implementation, it is vital to correctly define the variables utilized in this calculation:
- n: Represents the total number of subjects or patients (rows). In our specific example, n = 10.
- k: Represents the total number of treatment groups (columns). In this example, k = 3.
- ΣRj2: Represents the total sum of the squared rank totals for all treatment groups ($R_j$ is the sum of ranks for the jth group).
Crucially, under the assumption that the null hypothesis is true (i.e., assuming there is zero differential effect among the drug treatments), the derived test statistic $Q$ is known to follow an approximate chi-square distribution. The degrees of freedom (df) associated with this distribution are calculated as $k-1$. For our scenario with $k=3$ treatments, the degrees of freedom are $3 – 1 = 2$.
We utilize specialized Excel functions, notably the powerful CHISQ.DIST.RT function, to compute the final test statistic $Q$ and its associated p-value. The visual guide below clearly demonstrates the precise formulas required to perform these critical final calculations directly within the organized spreadsheet environment, translating the mathematical formula into functional spreadsheet logic:

Interpreting the Results and Drawing Conclusions
Following the meticulous calculations detailed in Step 3, we successfully derived the test statistic, yielding a value of $Q = mathbf{12.35}$. This quantitative outcome precisely measures the degree of observed variation in the rank sums across the three distinct drug conditions. To determine the probability of observing such a magnitude of variation purely by random chance, we must now turn our attention to the corresponding p-value.
The calculated p-value is $p = mathbf{0.00208}$. The standard statistical protocol requires comparing this derived p-value against the predefined level of significance ($alpha$), which is conventionally set at $0.05$. The decision rule is straightforward and absolute: if the calculated p-value is less than $alpha$, the researcher must reject the null hypothesis ($H_0$).
Since $0.00208$ is substantially smaller than the threshold of $0.05$, we possess robust evidence to confidently reject the null hypothesis, which had posited that the median reaction times for all three drugs were equivalent. This definitive rejection provides sufficient evidence to conclude that the specific type of drug administered results in a statistically significant difference in the measured response time. In practical terms for our clinical study, this means that at least one of the pharmaceutical drugs exerts an effect on patient reaction time that is significantly different from the others.
Step 4: Formal Reporting of the Statistical Results
The final crucial stage of any statistical project is the clear, accurate, and concise presentation of the findings, ensuring full compliance with accepted academic and reporting standards. The formal reporting of the Friedman Test necessitates the inclusion of essential elements: the study context, the resulting test statistic ($Q$), the degrees of freedom (df), and the precise p-value derived from the analysis.
The structure of the report should adopt a narrative yet highly precise tone, enabling readers to fully comprehend the methodology applied and the definitive conclusion reached based on the statistical evidence. The following blockquote presents an exemplary formal report format, effectively summarizing the outcomes of our drug study:
A Friedman Test was conducted on 10 patients to rigorously examine the differential effect of three distinct drugs on patient response time. The methodology utilized a repeated measures design, as each patient was measured under every drug condition.
Results showed that the type of drug used led to statistically significant differences in mean rank response time ($Q = 12.35$, $df = 2$, $p = 0.00208$). Consequently, the null hypothesis—which claimed population medians are equal across the three drug conditions—is confidently rejected.
Cite this article
Mohammed looti (2025). Understanding the Friedman Test: A Step-by-Step Guide in Excel. PSYCHOLOGICAL STATISTICS. Retrieved from https://statistics.arabpsychology.com/perform-the-friedman-test-in-excel/
Mohammed looti. "Understanding the Friedman Test: A Step-by-Step Guide in Excel." PSYCHOLOGICAL STATISTICS, 8 Nov. 2025, https://statistics.arabpsychology.com/perform-the-friedman-test-in-excel/.
Mohammed looti. "Understanding the Friedman Test: A Step-by-Step Guide in Excel." PSYCHOLOGICAL STATISTICS, 2025. https://statistics.arabpsychology.com/perform-the-friedman-test-in-excel/.
Mohammed looti (2025) 'Understanding the Friedman Test: A Step-by-Step Guide in Excel', PSYCHOLOGICAL STATISTICS. Available at: https://statistics.arabpsychology.com/perform-the-friedman-test-in-excel/.
[1] Mohammed looti, "Understanding the Friedman Test: A Step-by-Step Guide in Excel," PSYCHOLOGICAL STATISTICS, vol. X, no. Y, ص Z-Z, November, 2025.
Mohammed looti. Understanding the Friedman Test: A Step-by-Step Guide in Excel. PSYCHOLOGICAL STATISTICS. 2025;vol(issue):pages.