Consider some libreoffice-calc function called MYFUNC
which takes a cell range for example A2:B40
as an argument, so I can call MYFUNC(A2:B40)
.
Now I want to be able to write A2:B40
as text into another cell say D4
and give the cell range defined in D4
as an argument to MYFUNC
. I.e. I want to be able to write something like this MYFUNC(GETCELLRANGEFROM(D4)
which should be equivalent to MYFUNC(A2:B40)
.
Best Answer
Replacing
GETCELLRANGEFROM(D4)
byINDIRECT(D4)
should do what you want to achieve (given that D4 contains the stringA2:B40
). The INDIRECT function "translates" a string into a reference.Here's a short example how it works:
string
value, representating a reference to column A;=SUM(INDIRECT(B1))
So, C1 calculates a sum, based on the reference string in B1. Modifying B1 to
A1:A7
will change C1, too (resulting in 28). This way, INDIRECT "translates" a string to a reference that can be used in another (surrounding) formula.