Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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).

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Replacing GETCELLRANGEFROM(D4) by INDIRECT(D4) should do what you want to achieve (given that D4 contains the string A2:B40). The INDIRECT function "translates" a string into a reference.

Here's a short example how it works:

enter image description here

  • A1 to A9 holds some numbers,
  • B1 has a string value, representating a reference to column A;
  • C1 has the formula =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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.