HomeGoogle DocsSpreadsheetARRAY_ROW Function #REF Error and Solution in Google Sheets

ARRAY_ROW Function #REF Error and Solution in Google Sheets

Published on

What causes the ARRAY_ROW function #REF error in Google Sheets formulas? Is there any such function hidden somewhere in my code?

As far as I know, the ARRAY_ROW is an undocumented function in Google Sheets.

The purpose of this function is to combine equal-sized arrays/ranges, in terms of number of rows, horizontally.

We usually use curly brackets to combine two or more equal-sized ranges horizontally. We can use the ARRAY_ROW function instead.

Both will return a #REF error in case of mismatched ranges. If you hover your mouse over the error, you will see function ARRAY_ROW parameter ‘n’ has a mismatched row size.

ARRAY_ROW Function Syntax and Arguments

Before explaining how to remove the ARRAY_ROW function #REF error, let’s try to understand this simple function.

I couldn’t find any official documentation of the ARRAY_ROW function in Google Sheets. I think we can best write its syntax as follows.

Syntax: ARRAY_ROW(range1, [range2, …])

range1: The first range to combine horizontally.

range2, ...: Additional ranges to combine to range1. The number of rows in the additional ranges should match with range1.

Example

In the following example, see how to use the ARRAY_ROW function and curly brackets to append/combine ranges horizontally.

I have cost centers (project codes) in A2:A5 and the total labor strengths in Q1, Q2, Q3, and Q4 in corresponding column ranges, i.e., B2:E5.

How do I copy the cost center and Q3 and Q4 data to a separate range?

We can use the following formula.

=ARRAY_ROW(A2:A5,D2:E5)

Alternative Formula: ={A2:A5, D2:E5}

ARRAY_ROW Function in Google Sheets

Now time to see the cause of the ARRAY_ROW function #REF error and how to solve it.

ARRAY_ROW Function #REF Error and How to Solve It?

Usually, the said error happens when we use curly brackets to append two or more ranges.

I’m sure most Google Sheets users are not using the ARRAY_ROW function.

For one reason, it’s not a documented function. And the other is there is the much simpler curly braces alternative. We have already seen one example above.

There are two reasons for the ARRAY_ROW function #REF error in Google Sheets. Both reasons are most likely associated with curly braces usage.

  1. The user may want to combine two ranges or formula results vertically (one below the other). He accidentally placed them side by side (used a comma instead of a semicolon within the curly brackets). So there are chances of mismatching rows in the two ranges.
  2. When a user intentionally combines two formula results horizontally, which have mismatching row sizes. For example, say two IMPORTRANGE formulas side by side from two sheets.

I’ll show you the error first (the basic one), then come to the solution.

={A2:A10,D2:E5}
Example to ARRAY_ROW Function #REF Error

Solution

The solution to the ARRAY_ROW function #REF error depends on whether you really want to append the arrays horizontally.

If you want to append two or more ranges vertically, forget about the curly brackets approach. Use the VSTACK function.

If you want to place two or more ranges side by side, use the HSTACK function. It won’t cause the above #REF error.

In the above example, we can use =HSTACK(A2:A10, D2:E5) instead of the above curly bracket formula. So you won’t see the error.

The formula will place the ranges side by side.

But I suggest wrapping it with IFNA like =IFNA(HSTACK(A2:A10, D2:E5)). There is an obvious reason for it.

HSTACK will add ‘new’ rows below the lesser-sized range, and they contain #NA error values. We can clean it using the IFNA or IFERROR functions.

So to solve the function ARRAY_ROW parameter mismatch row error, use the HSTACK or VSTACK functions in Google Sheets.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

More like this

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.