Create a ROC Curve in Excel (Step-by-Step)


In the realm of predictive analytics and statistical modeling, rigorously evaluating the performance of classification models is not just important—it is absolutely essential for generating trustworthy insights. One of the most common and powerful techniques used for predicting binary outcomes (such as whether a customer will churn or if a loan will default) is Logistic Regression. To move beyond simple accuracy metrics and truly understand a model’s diagnostic power, analysts must focus on the interplay between two fundamental metrics: the True Positive Rate and the True Negative Rate.

  • Sensitivity (True Positive Rate): Often referred to as Recall, this metric quantifies the proportion of actual positive cases that were correctly identified by the model. High sensitivity is crucial in situations where minimizing false negatives—such as missing a medical diagnosis—is the primary concern.
  • Specificity (True Negative Rate): This metric measures the proportion of actual negative cases that were correctly identified. A high specificity score is vital for avoiding false alarms or false positives, ensuring the model is reliable when predicting negative outcomes.

While these metrics are clear individually, understanding their dynamic trade-off across various decision thresholds requires advanced visualization. This is precisely the role of the ROC curve, which stands for “Receiver Operating Characteristic.” The ROC curve provides a comprehensive graphical tool for evaluating the diagnostic effectiveness of any binary classifier, summarizing its performance regardless of the chosen threshold.

Although specialized statistical software is often used for these analyses, this detailed tutorial demonstrates how to leverage the ubiquitous capabilities of Microsoft Excel to generate, visualize, and properly interpret a ROC curve, making this powerful evaluation technique accessible to all data professionals.

Step 1: Structuring and Entering the Classification Data

The foundational step for generating any meaningful statistical visualization, including the ROC curve, involves meticulous data preparation. For this analysis, your raw dataset must contain two critical pieces of information: the predicted scores or probabilities assigned by the model, and the corresponding actual binary outcomes (e.g., 1/0, Pass/Fail). The relationship between these two variables will define the model’s performance characteristics.

We begin by organizing our data within the Excel spreadsheet. The hypothetical example provided below tracks the predicted scores and the actual results (categorized as ‘Pass’ or ‘Fail’) for a test scenario. It is crucial to arrange this information into adjacent columns to streamline the calculation steps that follow. Ensure that the classification results are aligned correctly with the predicted scores, as any misalignment will invalidate the subsequent rate calculations.

The illustration below shows the necessary starting structure. Note that the data is organized by the predicted score, which is a common practice, though not strictly required for the initial entry. Proper structure is key before moving on to calculating the cumulative totals needed for the True Positive and False Positive Rates.

Step 2: Determining Cumulative Pass and Fail Frequencies

To effectively plot the trade-off inherent in the ROC curve, we must first determine the cumulative counts for both the ‘Pass’ (Positive) and ‘Fail’ (Negative) categories. These cumulative frequencies establish the running totals necessary to calculate the True Positive Rate (TPR) and False Positive Rate (FPR) at every possible classification threshold defined by the unique predicted scores.

In Excel, we utilize the SUM function across Columns D (Cumulative Pass) and E (Cumulative Fail). A critical technical requirement here is the use of absolute referencing for the starting cell of the range (e.g., locking the row and column using dollar signs: $B$3). This ensures that as the formula is copied down the column, the starting point of the summation remains fixed, allowing the calculation range to expand correctly row by row.

The formulas entered into the third row of the respective columns are as follows. These calculations represent the growing count of positive and negative outcomes encountered up to that specific row, effectively simulating a running total:

  • Cumulative Pass values (Column D):
    =SUM($B$3:B3)
  • Cumulative Fail values (Column E):
    =SUM($C$3:C3)

Once entered, these formulas must be copied down to the final row of the dataset. The resulting values in the last row of Column D and Column E will provide the grand totals for positive and negative observations across the entire dataset, which will serve as the crucial denominators in the next step when calculating the actual rates.

Step 3: Calculating True Positive Rate, False Positive Rate, and AUC Segments

The True Positive Rate (TPR) and the False Positive Rate (FPR) are the coordinates that define the shape of the ROC curve. The TPR is equivalent to Sensitivity, representing the vertical axis, while the FPR (1 – Specificity) represents the horizontal axis. Furthermore, to provide a quantified measure of model strength, we must also calculate the individual segments necessary for determining the Area Under the Curve (AUC).

These rates are derived by dividing the running cumulative totals (from Step 2) by the overall dataset totals (the fixed denominator found in the last row, $D$14 and $E$14). The formulas below reflect the required calculations for columns F, G, and H, leveraging absolute referencing for the total counts to ensure correct rate normalization:

  • FPR (X-axis value, Column F): Calculated as 1 minus the ratio of cumulative passes to total passes.
    =1-D3/$D$14
  • TPR (Y-axis value, Column G): Calculated as 1 minus the ratio of cumulative fails to total fails.
    =1-E3/$E$14
  • AUC Component (Trapezoidal Area, Column H): This segment calculation prepares for the final AUC determination using the trapezoidal rule, based on the difference between adjacent FPR values and the current TPR value.
    =(F3-F4)*G3

These three formulas should be entered into the corresponding cells in the third row and then meticulously copied down to the remainder of the dataset. Column F now holds the crucial X-axis values (FPR), and Column G contains the Y-axis values (TPR). Column H is populated with the fractional areas that, when summed, will yield the total AUC.

Step 4: Generating the Receiver Operating Characteristic (ROC) Curve

With the coordinates for the TPR and FPR calculated for every possible classification threshold, the data is ready for visualization. The resulting graph—the ROC curve—is a powerful tool that visually summarizes the model’s discrimination ability across all potential decision boundaries.

The plotting procedure within Excel is straightforward. First, select the calculated coordinate pairs: highlight the entire data range containing the FPR (X-axis) and TPR (Y-axis) values, specifically cells F3 through G14 in our example. This selection captures all the necessary points to define the curve.

Navigate to the Insert tab on the Excel ribbon. Within the Charts group, select the Insert Scatter (X, Y) chart type, making sure to choose the option that connects the data points with smooth lines or markers. This action immediately renders the graphical representation of the model’s performance, providing an intuitive summary of its diagnostic efficacy.

ROC curve in Excel

Step 5: Interpreting Model Performance via AUC Calculation

The visual positioning of the generated ROC curve provides immediate insight into the model’s quality. Ideally, a highly effective binary classifier will exhibit a curve that strongly hugs the upper-left corner of the plot. This position signifies that the model achieves high sensitivity while simultaneously maintaining low false positive rates, indicating superior discrimination power.

However, relying solely on visual inspection can be subjective. To gain a single, objective, and threshold-independent metric of performance, we calculate the Area Under the Curve (AUC). The AUC provides a holistic measure of the model’s overall ability to distinguish between the positive and negative classes across all possible classification thresholds.

The closer the resulting AUC value is to 1.0, the better the classification performance of the logistic regression model. Conversely, an AUC of 0.5 suggests the model performs no better than random chance, rendering it ineffective for predictive purposes. Since we meticulously calculated the small trapezoidal area segments in Column H during Step 3, the final AUC calculation is simply the summation of those values using the SUM function in Excel:

Calculate AUC in Excel

For the dataset used in this tutorial, the calculated AUC value is 0.802662. This result is significantly above 0.5, confirming that the model demonstrates strong predictive capabilities and is highly successful in discriminating between the ‘Pass’ and ‘Fail’ outcomes.

Conclusion and Further Resources

Understanding and constructing the AUC and the ROC curve is fundamental for any serious model evaluation, especially in binary classification scenarios. This process, even when executed in a common tool like Excel, provides robust evidence of a model’s fitness for purpose.

For those dedicated to advancing their data analysis and statistical visualization expertise, exploring how to construct other critical statistical charts is highly recommended. The ROC curve is just one component of a comprehensive analytical toolkit.

These skills are universally applicable, allowing analysts to translate complex model performance into clear, actionable insights for stakeholders, regardless of the industry or specific predictive task.

Cite this article

Mohammed looti (2025). Create a ROC Curve in Excel (Step-by-Step). PSYCHOLOGICAL STATISTICS. Retrieved from https://statistics.arabpsychology.com/create-a-roc-curve-in-excel-step-by-step/

Mohammed looti. "Create a ROC Curve in Excel (Step-by-Step)." PSYCHOLOGICAL STATISTICS, 3 Nov. 2025, https://statistics.arabpsychology.com/create-a-roc-curve-in-excel-step-by-step/.

Mohammed looti. "Create a ROC Curve in Excel (Step-by-Step)." PSYCHOLOGICAL STATISTICS, 2025. https://statistics.arabpsychology.com/create-a-roc-curve-in-excel-step-by-step/.

Mohammed looti (2025) 'Create a ROC Curve in Excel (Step-by-Step)', PSYCHOLOGICAL STATISTICS. Available at: https://statistics.arabpsychology.com/create-a-roc-curve-in-excel-step-by-step/.

[1] Mohammed looti, "Create a ROC Curve in Excel (Step-by-Step)," PSYCHOLOGICAL STATISTICS, vol. X, no. Y, ص Z-Z, November, 2025.

Mohammed looti. Create a ROC Curve in Excel (Step-by-Step). PSYCHOLOGICAL STATISTICS. 2025;vol(issue):pages.

Download Post (.PDF)
Scroll to Top