How to define dynamic ranges on Calc (or Excel)?

后端 未结 2 1676
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 08:36

Let\'s say I have a Libreoffice.org Calc (maybe this goes for MS Excel too) object defined as the range $Sheet1.$A$1:$A$4.

I also have declared a constant w

相关标签:
2条回答
  • 2021-02-06 09:14

    You will need to use a version of this formula (excel) =CELL("contents",INDIRECT(CONCATENATE("A",startingLine)))
    This gives you the contents of cell A1 where startingLine is a constant 1. Additionally, if we define endingLine as A, we can replace A in the formula:
    =CELL("contents",INDIRECT(CONCATENATE(endingLine,startingLine)))

    To define a range for you might be =INDIRECT(CONCATENATE("$sheet1.$A$",startingLine,":$A$4"))
    for instance to sum (in excel) =SUM((INDIRECT(CONCATENATE("$A$",startingLine,":$A$4")))) but I am unfamiliar with the defining ranges in libreoffice

    0 讨论(0)
  • 2021-02-06 09:16

    To utilise the results of a list in LibreOffice calc as the definition for a secondary list the following works:

    First lists defined in DATA>DEFINE RANGE e.g. "Breakfast", "Dinner" where each item is a list containing a number of lines and is collectively named as either "Breakfast" or "Dinner".
    detailed menu choices

    the definition of the list named "Breakfast" might include: Bacon, Beans, Eggs, Hash Brown, Mushrooms, etc... this list is best defined on a separate sheet.

    If you want to select the menu choices from each list based on the selection of either "Breakfast" or "Dinner" you need a list defined in data>validity with those two options. Say this is defined in cell A2.
    Top level choices

    To connect the two detailed menu choices named either "Breakfast" or "Dinner" with the choice between either, use the formula:

    =indirect(A2)
    

    in say cell C2.

    When you select a choice from your defined list in A2, the spreadsheet will now use the entry in cell A2 to provide the correct list of choices in cell C2.

    I hope that makes sense - and a big thanks to Waldir Leoncio for the reminder!

    0 讨论(0)
提交回复
热议问题