The BYROW function in Google Sheets is a powerful tool that allows users to apply a specified LAMBDA function to each row of an array. This functionality enables more advanced data manipulation and processing, making it easier to perform calculations or transformations at a row level without the need for complex formulas or scripts. By utilizing BYROW, you can enhance your data analysis capabilities within spreadsheets.
Syntax
BYROW(array, LAMBDA)
- array: The range of cells or array you want to apply the LAMBDA function to.
- LAMBDA: A custom function defined using the LAMBDA keyword that will be executed for each row of the specified array.
Example #1
=BYROW(A1:C3, LAMBDA(r, SUM(r)))
This function sums each row of the range A1:C3. For instance, if A1:C3 contains values {1,2,3; 4,5,6; 7,8,9}, the result would be {6; 15; 24}.
Example #2
=BYROW(A1:A4, LAMBDA(r, MAX(r)))
In this example, the function retrieves the maximum value from each row within the range A1:A4. If A1:A4 contains values {3; 7; 2; 5}, the output would be {3; 7; 2; 5}.
Example #3
=BYROW(A1:B2, LAMBDA(r, AVERAGE(r)))
This calculation computes the average of each row in the A1:B2 range. Assuming A1:B2 holds values {4, 2; 6, 8}, the result will be {3; 7}.
Error handling
- VALUE! This error appears if the array is not valid or the LAMBDA function is missing. Ensure the parameters are set correctly.
- NAME? Occurs when the function name is misspelled or not recognized. Check for typographical errors in your formula.
- REF! Indicates a reference problem, often due to a deleted row or column in the referenced range. Verify that all references are intact.