ID EN
#Dynamic array

BYROW

Excel Functions 🇮🇩 Bahasa Indonesia

Terapkan fungsi ke baris

Syntax

EXCEL
=BYROW(array, function)

Arguments

Parameter Deskripsi
array The range or array to process.
function The function to apply to each row.

Return Value

Satu hasil per baris

Details

Fungsi BYROW menerapkan fungsi ke setiap baris dalam array dan mengembalikan satu hasil per baris dalam satu array. Misalnya, jika BYROW diberi rentang dengan 10 baris, ia mengembalikan larik yang berisi 10 hasil, satu hasil per baris. Penghitungan yang dilakukan pada setiap baris dapat berupa fungsi bawaan seperti SUM atau COUNT, atau fungsi LAMBDA khusus yang beroperasi pada nilai baris. BYROW sangat berguna dalam tiga situasi: Lihat di bawah untuk contoh spesifik. BYROW membutuhkan dua argumen: array untuk diproses dan fungsi untuk dijalankan pada setiap baris. Fungsinya dapat ditulis dengan dua cara. Cara pertama adalah sebagai LAMBDA custom bentuk panjang. Ini adalah bentuk umum, dan yang akan Anda lihat setiap kali penghitungan memerlukan logika khusus: Cara kedua adalah sintaksis bentuk pendek "eta lambda". Alih-alih membungkus fungsi dalam LAMBDA, Anda melewatinya

Contoh

Basic usage

BYROW takes two arguments: an array to process and a function to run on each row. The function can be written in two ways. The first way is as a long-

EXCEL
=BYROW(array,LAMBDA(row,SUM(row)))
=BYROW(array,LAMBDA(row,AVERAGE(IF(row<>0,row))))
=BYROW(array,LAMBDA(row,MAX(row)-MIN(row)))
Basic usage

The second way is a short-form "eta lambda" syntax. Instead of wrapping the function in a LAMBDA, you pass just the function name. This works for sing

EXCEL
=BYROW(array,SUM) // sum each row
=BYROW(array,MAX) // max of each row
=BYROW(array,AVERAGE) // average of each row
=BYROW(array,COUNTA) // count of non-empty values
Sum each row

In the worksheet below, the goal is to sum the values in each row of the range C5:H15. The formula in J5 is:

EXCEL
=BYROW(C5:H15,SUM)
Sum each row

BYROW processes all 11 rows at once and returns an array of 11 sums that spill into J5:J15. The same pattern works for any single-argument aggregate:

EXCEL
=BYROW(C5:H15,MAX) // max of each row
=BYROW(C5:H15,MIN) // min of each row
=BYROW(C5:H15,AVERAGE) // average of each row
Count values per row that meet a condition

BYROW is useful when you want to count values per row that meet one or more specific conditions. This is where the eta syntax breaks down and the full

EXCEL
=BYROW(C5:H15,LAMBDA(row,SUM(--(row>90))))
Average each row ignoring zeros

Zeros sometimes mean "no data" rather than "a real value of zero" (a store that wasn't open, a test that wasn't taken, a product that wasn't stocked).

EXCEL
=BYROW(C5:G15,LAMBDA(row,AVERAGE(IF(row<>0,row))))

See Also

LAMBDA LET MAP SCAN REDUCE MAKEARRAY BYCOL