The Ackermann function, named after Wilhelm Ackermann, is a multi-variable function from natural numbers to natural numbers with a very fast rate of growth. The function relies on solving with recursive calculations. In this guide, we're going to show you how to calculate Ackermann function in Excel.

Download Workbook

Ackermann Function and recursion

Recursion is a term for describing the behavior for when a function calls itself from within its own code. The Ackermann function can call itself as well. Here is the equation:

How to calculate Ackermann function in Excel 01

If m and n values are not equal to 0 (third line), the function calls itself to calculate its second argument. The called function will call another, until the conditions in the first two rows are met.

Ackermann Function in Excel

Before the LAMBDA function, the only option for recursive calculations in Excel was using VBA. VBA allows you to create your own user defined functions and use them recursively. However, VBA requires some coding knowledge.

Thanks to the new LAMBDA function, you can create your own functions using Excel formulas, without any coding experience. Briefly, the LAMBDA function is a special function that you can use in a named range and allows you to use that named range as an individual function. It also supports recursive calculations.

Let’s see how you can create the Ackermann function using the LAMBDA function.

Creating a user defined function with LAMBDA

  1. Open the New Name dialog by following the Formulas > Define Name path in the Ribbon.
  2. Type in a friendly name for your formula. We used “Ack”.
  3. Enter the formula below. Please note that the formula contains the “Ack” string as the formula name. This is how we are building a recursive calculation. Thus, if the name of your formula is different, update the formula accordingly.
  4. Click the OK button to create your user defined function.
  5. Once the named range is saved, you can use it as a regular formula.

LAMBDA Function


Let us briefly explain how the LAMBDA function works. The LAMBDA function’s last argument should always be the formula itself. The arguments before the formula are the arguments which will be used in the formula.

In the Ackermann function example, the function needs 2 arguments: m and n. Thus, the first arguments in the LAMBDA function are m and n in this example. The last argument is the formula that uses the m and n parameters.

As of writing this article, you need Office 365 to access the LAMBDA function.