Leila Gharani introducing Excel BYROW and BYCOL functions

Get the BYROW and BYCOL Practice Workbook

Follow Leila’s examples and practice using BYROW, BYCOL, LAMBDA, and FILTER to find sales above a target.

The worksheet contains monthly sales figures for seven employees. Each row represents an employee, and each column represents a month. The sales target is $1,500 in cell B13. We want to find which months had at least one sale above that target and which employees achieved it.

Excel sales table with employee names in rows and monthly sales in columns

Excel version: BYROW and BYCOL are available in Microsoft 365 and Excel 2024. They aren’t available in perpetual Excel 2021 or older versions.

Use BYCOL to Find Months Above a Sales Target

BYCOL processes a range one column at a time. It passes each column to a LAMBDA calculation and returns one result per column. In our example, that means we can check all 12 months with one formula.

To perform this operation using a single formula, we will take advantage of the new BYCOL function.

The BYCOL function applies a LAMBDA to each column and returns an array of the results.

More plainly stated: you supply a formula and a range of columns, and the BYCOL function will execute that formula to each column of data separately.  This will produce an array of results; one for each column in the original data range.

Understand BYCOL with a Simple SUM Example

Before testing the sales target, let’s see BYCOL in action with SUM. Instead of writing 12 separate SUM formulas, we can calculate the total sales for every month in one step.

Enter the formula in an empty cell below the sales target, with enough room for 12 results to spill across the row. Don’t enter it in B13 because that cell contains the $1,500 target.

=BYCOL(B5:M11, LAMBDA(MonthSales,SUM(MonthSales)))

We’ll break this formula down in just a moment, but I want to quickly show why this is worth using.

The above formula would yield the same results as creating a separate SUM formula for each of the 12 months.

Excel passes each month’s sales into the LAMBDA calculation and returns 12 totals, one for each month. The results spill across the worksheet automatically.

BYCOL with LAMBDA and SUM calculating a separate sales total for each month

How BYCOL and LAMBDA Work Together

The formula has two main parts. BYCOL identifies the range to process, while LAMBDA defines what Excel should calculate for each column.

We begin with the BYCOL function.

=BYCOL(

This function is looking for an array of data by which it will separate into single columns of data.

B5:M11 contains the sales figures for all seven employees across 12 months. BYCOL processes each of these columns separately.

=BYCOL(B5:M11,

Next, we give the BYCOL function a formula to exercise on every single column of data.

The formula is handled via the LAMBDA function.

Don’t worry if you’re not familiar with the LAMBDA function.  LAMBDA has two arguments: the first is the data to be manipulated and the second is the formula to execute.

MonthSales is a temporary name for the column currently being processed. Excel automatically passes each column into that name. Don’t put the name in quotation marks because it’s a LAMBDA parameter, not a text value.

=BYCOL(B5:M11, LAMBDA(MonthSales,

As each column of sales is passed into the LAMBDA function, the function exercised on each iteration of data is a traditional SUM function.  SUM will use the “MonthSales” variable instead of traditional cell references.

=BYCOL(B5:M11, LAMBDA(MonthSales,SUM(MonthSales)))

If you’re new to naming calculations inside formulas, see our guide to the Excel LET function. LET also uses names to make formulas easier to read, although it serves a different purpose from LAMBDA.

Combine BYCOL with COUNTIF and FILTER

Now let’s return to our original question: which months contain at least one sale above $1,500? We’ll replace SUM with COUNTIF to count matching sales in each month.

Count Sales Above the Target with BYCOL

Start with a BYCOL function and supply the range of data to be processed.

=BYCOL(B5:M11,

Next, create a LAMBDA function that uses a variable named “mycol”.  The variable name can be anything you wish.  It is there to accept the input supplied at each iteration of the BYCOL function.

=BYCOL(B5:M11, LAMBDA(mycol,

COUNTIF checks each month’s sales against the target in B13. The criterion ">"&B13 tells Excel to count values greater than the target. The ampersand joins the comparison operator with the cell reference.

=BYCOL(B5:M11, LAMBDA(mycol, COUNTIF(mycol, “>” & B13) ) )
BYCOL and COUNTIF formula counting sales above the $1,500 target for each month

Each result shows how many employees exceeded the target in that month. A zero means nobody did. A value greater than zero means the month qualifies for our final list.

NOTE: We must place the greater-than sign in quotes since we a concatenating text with a cell reference.

Any column that has a sale greater than the value in cell B13 will be counted.

Return Matching Months with FILTER

We don’t need the counts in our final result. We need the month names. FILTER returns the headings from B4:M4 where the corresponding BYCOL count is greater than zero.

=FILTER(B4:M4, BYCOL(B5:M11, LAMBDA(mycol, COUNTIF(mycol, “>” & B13) ) ) > 0)
FILTER and BYCOL returning the months with sales above the target

For more ways to return matching records with formulas, see our complete Excel FILTER function tutorial.

Display the Results Vertically with TRANSPOSE

FILTER returns the matching month names horizontally because the original month headings are arranged in a row. Wrap the formula in TRANSPOSE to display the same results vertically.

=TRANSPOSE(FILTER(B4:M4, BYCOL(B5:M11, LAMBDA(mycol, COUNTIF(mycol, “>” & B13) ) ) > 0) )
TRANSPOSE converting the matching months from a horizontal list to a vertical list

Use BYROW to Find Employees Above a Sales Target

Now let’s find the employees who recorded at least one sale above the target. Because each employee occupies a separate row, we’ll use BYROW instead of BYCOL.

Count Sales Above the Target with BYROW

We start in the same way as before but with a BYROW function instead of a BYCOL function.

=BYROW(

The array of data that we will iterate thru one row at a time is the same array used in the first objective: B5:M11.

=BYROW(B5:M11,

We feed the BYROW function a LAMBDA function that uses a variable named “myrow”.

=BYROW(B5:M11, LAMBDA(myrow,

BYROW passes each employee’s 12 monthly sales figures into LAMBDA. COUNTIF then counts how many values exceed the target. The result is one count per employee, displayed vertically.

=BYROW(B5:M11, LAMBDA(myrow, COUNTIF(myrow, “>” & B13) ) )

The results show us how many times an employee had a sale that exceeded the target.

BYROW and COUNTIF counting how often each employee exceeded the sales target

Return Matching Employees with FILTER

Finally, wrap BYROW inside FILTER. Use A5:A11 as the range to return and keep only employees whose BYROW count is greater than zero.

=FILTER(A5:A11, BYROW(B5:M11, LAMBDA(myrow, COUNTIF(myrow, “>” & B13) ) ) > 0)
FILTER and BYROW returning employee names with sales above the target

Try changing the target: Change B13 from 1500 to 1900. The matching months and employees update automatically. In the video, the employee list narrows to Doug and Cat at the higher target.

BYROW vs. BYCOL: Which Should You Use?

The difference comes down to how your data is arranged.

Use BYCOL when you want to perform the same calculation on every column. In our example, the months are in columns, so BYCOL checks each month separately.

Use BYROW when you want to perform the same calculation on every row. Here, each employee has one row of sales figures, so BYROW checks each employee separately.

Both functions work with LAMBDA and return one result per row or column. You can combine them with SUM, COUNTIF, MAX, AVERAGE, and other calculations, then use FILTER to return only the results you need.

The benefit is that you maintain one formula rather than a separate calculation for every row or column.

Download the BYROW and BYCOL Practice Workbook

Download the BYROW and BYCOL Practice Workbook

Get the Excel practice file and build formulas that identify matching months and employees without copying calculations across every row or column.

Frequently Asked Questions

What is the difference between BYROW and BYCOL in Excel?

BYROW applies a calculation to each row of a range and returns one result per row. BYCOL does the same for each column. Use BYROW when your records are arranged in rows and BYCOL when you want to analyze individual columns.

Do BYROW and BYCOL require LAMBDA?

Yes. Both functions use LAMBDA to define the calculation performed on each row or column. The LAMBDA parameter is a temporary name for the current row or column, and its calculation must return a single value.

How do I find months with sales above a target using BYCOL?

Use BYCOL with COUNTIF to count values greater than the target in each month. Then use FILTER to return only the month headings where the count is greater than zero. Wrap the result in TRANSPOSE if you want the months listed vertically.

How do I find employees who exceeded a sales target using BYROW?

Use BYROW with COUNTIF to check each employee’s sales across the months. Then use FILTER to return the employee names where at least one sale exceeded the target. The results update when the target value changes.

Why does FILTER return a #CALC! error when no values match?

FILTER can return #CALC! when no values meet the condition because Excel can’t return an empty array. Add an empty string as the optional third argument to display a blank result instead.

Which Excel versions support BYROW and BYCOL?

BYROW and BYCOL are available in Excel for Microsoft 365 and Excel 2024, including the Mac versions. They aren’t supported in perpetual Excel 2021 or earlier versions.

Leila Gharani

Founder of XelPlus and ten-time Microsoft MVP. Leila helps over 500,000 professionals master Excel, Power BI, and data automation through practical, real-world training.