Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Google Spreadsheet ADDRESS function to create a range

I'm trying yo create a formula in google spreadsheet that calculates the maximum value for all the cells above the current cell, in a way I can copy it to any cell and still workss. I tried using the ADDRESS function like this:

=MAX(ADDRESS(1;COLUMN()):ADDRESS(ROW()-1;COLUMN()))

But I get an parse error. I tried many variants of this code, but always get an error. Apparently, the ADDRESS function is not allowed as part of a range.

Is there any way to create a reference to a range based on the current cell position?

like image 857
pablochacin Avatar asked Aug 26 '14 13:08

pablochacin


2 Answers

Was stuck on something very similar. Something like this should work.

=MAX(INDIRECT(1, COLUMN()) & ":" & ADDRESS(ROW()-1, COLUMN())))
like image 162
dev Avatar answered Oct 17 '22 21:10

dev


This might be useful too if you want to get the sting address for a range:

=ADDRESS(row(A3:A6),COLUMN(A3:A6))&":"&ADDRESS(row(A3:A6)+rows(A3:A6)-1,COLUMN(A3:A6)+COLUMNS(A3:A6)-1)

This will return a string on the range, in this case

$A$3:$A$6

like image 23
Brendan Wilding Avatar answered Oct 17 '22 23:10

Brendan Wilding