 Highlighted

# Please explain the logic behind this issue? Cell range / array question.

Hi there,

I've just learned that you can use a function within an range instead of a cell reference. I however do not understand the logic behind it and need some assistance in understanding it. Please help!

What I mean, for example, is that you can create a function like sum(A1:offset(x,y,z), where x,y,z are a cell reference, and two whole numbers, respectively.

Logically, this seems like it would make sense if the offset function returned a cell reference. However, it does not; it returns a cell value.

What is strange to me is that despite the above SUM function working fine, when you input a cell value in the place of offset (even if it is the same value that the offset function returns) then the SUM function fails. For example, if you enter the formula sum(A1:1000), it fails. But if your OFFSET function returns a value of 1000, it works.

Could someone please explain this to me?

Thanks a lot.

2 Replies
Highlighted

# Re: Please explain the logic behind this issue? Cell range / array question.

take a long look (i.e., read through) this page on the OFFSET function and see if it explains how it works to your satisfaction:

https://exceljet.net/excel-functions/excel-offset-function

Highlighted

# Re: Please explain the logic behind this issue? Cell range / array question.

Few functions return a reference, not only OFFSET. For example, to return the range A5:A10 you may use formulas like

``=OFFSET(A1,4,0):OFFSET(A1,9,0)``

or

``=IF(1,A5,0):IF(1,A10,0)``

or other functions which could return references: OFFSET, INDEX, XLOOKUP, IF, SINGLE, CHOOSE, SWITCH. I lost the source there they are listed, you may google for them.

If only one range reference is returned by formula, it looks like

``=A5:OFFSET(A1,9,0)``

You may use such dynamic ranges in other formulas same way as fixed one, e.g.

``````=SUM(A5:OFFSET(A1,9,0))

is equivalent of

=SUM(A5:A10)``````

but

``=SUM(A5:10)``

is just wrong syntax.