Scans an array by applying a LAMBDA to each value and returns an array that has each intermediate value.
ฟังก์ชันนี้ทำงานใน Google Sheets เหมือนกับใน Excel — ไวยากรณ์และอาร์กิวเมนต์เดียวกัน
SCAN(initial_value, array, lambda)The SCAN function iterates through an array and applies a LAMBDA function to each element, maintaining an accumulator that updates at every step. It returns an array of the same size as the input, showing the progression of the calculation.
=SCAN(0, {1, 2, 3}, LAMBDA(a, v, a+v))ผลลัพธ์: {1, 3, 6}
Calculates the running total of the array {1, 2, 3} starting from 0.
SCAN returns an array of all intermediate results, whereas REDUCE only returns the final accumulated value.