Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Scans an array by applying a LAMBDA to each value and returns an array that has each intermediate value.  

Syntax

=SCAN ([initial_value], array, lambda(accumulator, value))

The SCAN function syntax has the following arguments and parameters:

  • [initial_value]      Sets the starting value for the accumulator.

  • array      An array to be scanned.

  • lambda      A LAMBDA that is called to scan the array. The LAMBDA takes two parameters: 

    • accumulator    The value totaled up and returned as the final result.

    • value     The calculation applied to each element in the array.

Remarks

Use the initial_value argument to set the starting value for the accumulator parameter. If you are working with text, set the initial value to "".

Errors

Providing an invalid LAMBDA function or an incorrect number of parameters returns a #VALUE! error called "Incorrect Parameters".

Examples

Example 1: Create a list of factorials

Enter the sample data into cells A1:C2, and then copy the formula into cell D4:

=SCAN(1, A1:C2, LAMBDA(a,b,a*b))

First SCAN function example

Example 2: Concatenate characters in an array

Enter the sample data into cells A1:C2, and then copy the formula into cell D4:

=SCAN("",A1:C2,LAMBDA(a,b,a&b))

Second SCAN function example

See Also

LAMBDA function

MAP function

REDUCE function

MAKEARRAY function

BYCOL function

BYROW function

ISOMITTED function

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×