ROWS does not spill?

BrianGGG

Board Regular
Joined
Mar 5, 2016
Messages
62
Hi. Anyone have any idea why...

This array formula "spills", or creates 3 values:

Code:
$A$1:(A1:A3)

However, wrapping it in ROWS does not spill (or creates a simple value of 3):

Code:
ROWS($A$1:(A1:A3))
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi Brian,

Does this work for you?

Code:
=SEQUENCE(ROWS(A1:A3))

I love the new array structure!
 
Upvote 0
@BrianGGG.... A1:(A1:A3) and (A1:A3):A3 are simply the range A1:A3. If we array-enter a formula with A1:A3, we get 3 separate values.

But the ROWS() parameter is a range. If we enter ROWS(A1:A3), we get 3 because ROWS() "consumes" the entire range. If we array-enter a formula with ROWS(A1:A3), we get an array of 3s, the equivalent of an array of the formulas ROWS(A1:A3), ROWS(A1:A3), ROWS(A1:A3).

The same issue applies to AND() and OR() functions. It is the reason why we cannot use them as we might intend in an array-entered formula.

For example, we might array-enter =IF(AND(A1:A3=B1:B3),C1:C3) with the intent for that to be treated like an array of the formulas IF(A1=B1,C1), IF(A2=B2,C2), IF(A3=B3,C3). But instead, it is treated as IF(TRUE,C1:C3) or IF(FALSE,C1:C3) because AND(A1:A3=B1:B3) returns a single logical value, the equivalent of AND(A1=B1,A2=B2,A3=B3).

Bottom line: functions that expect array and range parameters cannot be used in array-entered formula with the intent of creating an array of unique values.
 
Last edited:
Upvote 0
PS.... When I want an array of the numbers 1 to n, I use ROW(A1:A3) or ROW(A1:INDEX(A:A,X1)). ROW, not ROWS. I use the first form when I know "n" (3, in this example). I use the second form when "n" is a variable (the value of X1, in this example). I purposely avoid using INDIRECT because that is a "volatile" function. It causes the formula that references it and all directly or indirectly dependent formulas to be recalculated any time any cell in the workbook is recalculated.
 
Upvote 0
Thanks @joeu2004 and @KevCarter

I think it's a great analogy that ROWS and other functions "consume" or "swallow" the arrays into a single value.
I can work around it with the examples above.

I have a similar problem with SUM that I'll post separately ...
 
Upvote 0
Thanks @joeu2004 and @KevCarter

I think it's a great analogy that ROWS and other functions "consume" or "swallow" the arrays into a single value.
I can work around it with the examples above.

I have a similar problem with SUM that I'll post separately ...

ROWS, SUM, AVERAGE, MAX, etc. applied to a reference delivers a single summary score (a scalar value).
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top