ZetCode

Excel ERF Function

last modified October 5, 2026

The ERF function returns the error function, a special function that appears throughout probability theory, statistics, and engineering. It integrates the Gaussian curve between two limits, which makes it a natural tool for working with the normal distribution. This tutorial provides a comprehensive guide to using the ERF function with detailed examples. You'll learn basic syntax, the one- and two-argument forms, and practical applications.

ERF Function Basics

The ERF function returns the error function integrated between a lower and an upper limit. With a single argument it integrates from zero to that value, and with two arguments it integrates between them. The result is closely related to the cumulative normal distribution.

Component Description
Function Name ERF
Syntax =ERF(lower_limit, [upper_limit])
Arguments lower_limit (required), upper_limit (optional)
Return Value Error function value between -1 and 1

This table breaks down the essential components of the ERF function. It shows the function name, the syntax, the argument requirements, and the range of the return value.

Argument Meaning
lower_limit The lower bound of integration. When it is the only argument, the integration starts at zero and this value acts as the upper bound.
upper_limit The upper bound of integration. If omitted, ERF integrates between zero and lower_limit.

Both arguments must be numeric. A non-numeric argument produces a #VALUE! error, while negative limits are accepted and yield a negative result.

The Error Function Definition

The error function is defined by an integral of the Gaussian bell curve. For a real number x, it is:

Definition of the error function
ERF(x) = (2 / SQRT(PI)) * integral from 0 to x of EXP(-t^2) dt

Because the integrand is even, the function is odd: ERF(-x) equals -ERF(x), and ERF(0) is exactly 0. As x grows, the value approaches 1 from below, so ERF(2) is about 0.9953 and ERF(3) is already about 0.99998. The two-argument form follows directly from the definition: ERF(a, b) equals ERF(b) - ERF(a).

Basic ERF Example

This example demonstrates the simplest use of the ERF function with a single limit. The function integrates from 0 to the specified value.

Basic ERF formula
=ERF(1)

This formula calculates the error function from 0 to 1. The result is approximately 0.8427, the value Microsoft documents for =ERF(1). This shows how ERF works with a single argument.

ERF with Two Limits

ERF can calculate the integral between any two points, not just from zero. The second argument is the upper bound, so the result is the difference of the two one-argument values.

A B
0.5
1.5
=ERF(A1, A2)

The table shows a simple spreadsheet with limits in cells A1 and A2. The ERF formula in B3 calculates the integral between these two points.

ERF with two limits
=ERF(0.5, 1.5)      ' 0.4456, equals ERF(1.5) - ERF(0.5)
=ERF(1, 2)          ' 0.1526, equals ERF(2) - ERF(1)

The first formula calculates the error function between 0.5 and 1.5, which is 0.4456. The second integrates between 1 and 2 and returns 0.1526. Note that ERF(0.5) alone is 0.5205, so the two-argument form is not the same as evaluating one limit by itself.

One-Argument vs Two-Argument Forms

The two forms answer different questions. The single-argument form always starts at zero, while the two-argument form measures the area between any two bounds.

Form Integrates Example Result
=ERF(x) from 0 to x =ERF(1) 0.8427
=ERF(a, b) from a to b =ERF(1, 2) 0.1526

Because ERF(a, b) = ERF(b) - ERF(a), the two-argument form can return a negative value when the upper limit is smaller than the lower limit. For example, =ERF(2, 1) returns -0.1526.

ERF with Negative Values

ERF accepts negative limits. The function is odd, so a negative input produces the negative of the corresponding positive result, and a symmetric interval such as (-1, 1) returns twice the one-argument value.

A B
-1
=ERF(A1)

This table demonstrates the calculation with a negative input value. The function keeps its odd symmetry for negative inputs.

ERF with negative value
=ERF(-1)            ' -0.8427
=ERF(-1, 1)         '  1.6854, equals 2 * ERF(1)

This formula calculates the error function from 0 to -1. The result is approximately -0.8427. Integrating from -1 to 1 covers both tails and returns 1.6854, which is twice ERF(1).

ERF in Probability Calculations

ERF is often used with the normal distribution. The standard normal cumulative distribution is 0.5 * (1 + ERF(z / SQRT(2))), and ERF(z / SQRT(2)) gives the probability that a standard normal value falls between -z and z.

A B
1.96
=ERF(A1/SQRT(2))

The table shows how to use ERF to calculate a two-sided probability for a standard normal distribution. The formula converts a z-score into an interval probability.

ERF for normal distribution
=ERF(1.96/SQRT(2))              ' 0.9500, P(-1.96 < Z < 1.96)
=0.5*(1+ERF(1.96/SQRT(2)))      ' 0.9750, the one-sided CDF

The first formula returns approximately 0.9500, the familiar 95% central interval found in statistical tables. The second adds the lower tail to obtain the one-sided cumulative probability of 0.9750. This is why the 1.96 z-score appears so often in confidence interval calculations.

ERF with Cell References

For practical applications, ERF is often used with cell references rather than hard-coded values. This example demonstrates this approach.

A B C
0.2 0.8
=ERF(A1, B1)

The table illustrates using ERF with cell references for both limits. This approach makes the formula dynamic and easily adjustable.

ERF with cell references
=ERF(A1, B1)        ' 0.5194 for A1=0.2 and B1=0.8

This formula calculates the error function between the values in A1 (0.2) and B1 (0.8). The result is approximately 0.5194. Cell references make the formula more flexible.

ERF vs ERF.PRECISE

Excel also provides ERF.PRECISE. Microsoft replaced the legacy ERF with this newer function, which provides improved accuracy and a clearer name. The difference is that ERF.PRECISE takes only one argument and always integrates from zero.

Function Arguments Integrates Status
ERF lower_limit, [upper_limit] 0 to x, or a to b Legacy, kept for compatibility
ERF.PRECISE x only 0 to x Modern replacement
ERF.PRECISE takes a single argument
=ERF(1)             ' 0.8427
=ERF.PRECISE(1)     ' 0.8427, identical result
=ERF.PRECISE(1, 2)  ' error, only one argument is allowed

For a single limit the two functions agree exactly, so =ERF(1) and =ERF.PRECISE(1) both return 0.8427. When you need an interval between two non-zero bounds, use ERF(a, b) or compute ERF.PRECISE(b) - ERF.PRECISE(a).

ERFC Complementary Function

Excel also provides ERFC, the complementary error function. It is defined as ERFC(x) = 1 - ERF(x), so it returns the area in the tails beyond x rather than the area from zero to x.

ERF and ERFC relationship
=1-ERF(1)           ' 0.1573
=ERFC(1)            ' 0.1573, same value

For x = 1, ERF(1) is 0.8427, so 1 - ERF(1) equals 0.1573, which matches ERFC(1). The complementary function is useful when the quantity of interest is the tail probability.

ERF Errors and Troubleshooting

Cause Symptom Fix
lower_limit is text #VALUE! error Make sure the cell or literal is numeric
upper_limit is text #VALUE! error Use a number or a numeric cell reference
Too many arguments Too many arguments error ERF accepts at most two arguments
An argument is an existing error The same error is passed through Fix the source cell before calling ERF
Empty cell used as a limit 0 is used for that limit Fill the cell or supply a default value

The ERF function is essential for probability and engineering calculations in Excel. From a simple one-argument evaluation to two-sided normal probabilities, it maps the Gaussian integral onto the spreadsheet grid. Remember that the single-argument form integrates from zero, that ERF(a, b) equals ERF(b) - ERF(a), and that ERF.PRECISE is the modern replacement for the single-argument case. Mastering these relationships lets you move confidently between error functions, z-scores, and cumulative probabilities.

Author

My name is Jan Bodnar, and I am a passionate programmer with extensive programming experience. I have been writing programming articles since 2007. To date, I have authored over 1,400 articles and 8 e-books. I possess more than ten years of experience in teaching programming.

List all Excel Formulas.