Excel SCAN Function Tutorial

Version: Microsoft 365
Last update:
Tip: Use ⬆️ ⬇️ to turn the page up and down. We recommend browsing with a large screen for a better reading experience.

1. Introduction to the SCAN Function

The SCAN function in Excel is used to perform cumulative calculations on a range of data. It applies a function cumulatively across an array, returning an array of results. This can be incredibly useful in various applications, such as creating running totals, tracking cumulative sales, or analyzing trends over time.
Introduction to the SCAN Function

2. Parameters of the SCAN Function

Here is the syntax for using the SCAN function.
=SCAN ([initial_value], array, lambda(accumulator, value, body))
  • [initial_value] : required Sets the starting value for the accumulator.
  • array: required The array to be scanned.
  • lambda: required The LAMBDA used to accumulate the array. LAMBDA requires three parameters:
  • accumulator: required The value totaled up and returned as the final result.
  • value: required The current value from the array.
  • body: required The calculation applied to each element in the array.
  • 3. Example Scenario

    Suppose you are tracking a small business's sales data over a week. You want to calculate the cumulative sales for each day to better understand the trends.
    Example Scenario

    4. Getting Started with the SCAN Function

    Type on your keyboard: =SCAN(
    Getting Started with the SCAN Function

    5. Enter SCAN Function Parameters

    Here we set the starting value for accumulation to 0, selecting C5:C9 as the array to accumulate, and preparing to define the accumulation Lambda.
    Enter SCAN Function Parameters

    6. Enter Lambda Parameters

    Here we name the accumulated result as: result, with the array element as: x, then set the accumulation formula as: result + x, and complete the corresponding parentheses.

    Note that result and x are user-defined names and can be renamed as per personal preference.
    Enter Lambda Parameters

    7. Effect of the SCAN Function

    After pressing Enter to save, you can see the effect of the SCAN function, which successfully accumulates the current sales for each day.
    Effect of the SCAN Function

    8. Other Accumulation Formulas

    The Lambda operations here are not limited to addition; we can add more custom operations.

    For example, here we can halve the daily sales before accumulating.
    Other Accumulation Formulas

    9. 🎉 Finish! 🎉

    Author's Note: I hope you can feel the effort I put into these tutorials. I hope to create a series of very easy-to-understand Excel tutorials.

    If it is useful, help me share these tutorials, thank you!


    Follow me:
    Introduction to the SCAN Function