ID EN
#Dynamic array

SCAN

Excel Functions 🇮🇩 Bahasa Indonesia

Pindai array dan kembalikan hasil antara

Syntax

EXCEL
=SCAN([initial_value], array, function)

Arguments

Parameter Deskripsi
initial_value [optional] The initial value of the accumulator. Default is zero.
array The array to be scanned.
function The function or custom LAMBDA to apply.

Return Value

Berbagai hasil

Details

Fungsi SCAN menerapkan penghitungan khusus untuk setiap elemen dalam larik tertentu dan mengembalikan larik yang berisi setiap nilai perantara yang dibuat selama pemindaian. SCAN dapat menghasilkan total berjalan, jumlah berjalan, dan perhitungan lain yang menghasilkan hasil antara atau tambahan. Hasil yang dikembalikan oleh SCAN adalah nilai "akumulator" pada setiap langkah proses. Seperti fungsi REDUCE, SCAN melakukan iterasi pada semua elemen dalam array dan melakukan perhitungan pada setiap elemen sambil memperbarui nilai akumulator. Namun, ketika REDUCE mengembalikan nilai tunggal, SCAN mengembalikan serangkaian nilai. Fungsi SCAN membutuhkan tiga argumen: nilai_inisial, array, dan fungsi. Initial_value adalah nilai benih awal yang digunakan untuk hasil pertama. Initial_value adalah opsional dan default t

Contoh

LAMBDA structure

The SCAN function takes three arguments: initial_value, array, and function. Initial_value is the initial seed value to use for the first result. Init

EXCEL
LAMBDA(a,v,calculation)
LAMBDA structure

The first argument, a, is the accumulator used to store intermediate values. The accumulator begins as the initial_value provided to SCAN and changes

EXCEL
=SCAN(0,{1,2,3},LAMBDA(a,v,a+v)) // returns {1,3,6}
SCAN for a basic running total

A simple use of SCAN is to create a running total. In the worksheet shown below, we have a list of values in the range B5:B16, and we want to create a

EXCEL
=SCAN(0,B5:B16,LAMBDA(a,v,a+v))
SCAN with abbreviated function syntax

Like other newer dynamic array functions, SCAN supports an abbreviated syntax for the function argument. Using the abbreviated syntax, the formula abo

EXCEL
=SCAN(0,B5:B16,SUM)
SCAN with abbreviated function syntax

It is not obvious, but SCAN is delivering two values, the accumulator and the value to the SUM function at each loop. The result is a running total. W

EXCEL
=SCAN(0,B5:B16,COUNT) // returns {2,2,2,2,2,2,2,2,2,2,2,2}
SCAN with a dynamic range

One of SCAN's key strengths is its ability to work with dynamic arrays. When you give SCAN an array that is dynamically generated, it will automatical

EXCEL
=SCAN(0,TRIMRANGE(B5:B1000,2),SUM)

See Also

LAMBDA LET MAP SCAN REDUCE MAKEARRAY BYCOL BYROW