本文介绍了如何在Calc(或Excel)上定义动态范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个Libreoffice.org Calc(也许这适用于MS Excel)对象定义为范围 $ Sheet1。$ A $ 1:$ A $ 4



我也已经声明了一个值为1的常量。对于这个模型,我们称之为 startingLine 。 p>

在定义名称对话框(快捷键:Ctrl + F3)中正确定义了两个对象。



我想要什么要做的是将定义范围的转换为变量。在我看来,所有这一切将是这样定义的: $ Sheet1。$ A $ startingLine:$ A $ 4 ,但这不行。 : - /



我正在寻找一个简单的电子表格解决方案,不幸的是宏不会为我这样做。然而,使用R1C1参考的解决方案将是足够好的。 :



任何帮助将大大赞赏

解决方案

您将需要使用该公式的版本(excel)
= CELL(contents,INDIRECT(CONCATENATE(A,startingLine))) code>

这给出了单元格A1的内容,其中 startingLine 是一个常量1.另外,如果我们定义 endLine as A,我们可以用公式替换A:

= CELL(contents,INDIRECT(CONCATENATE(endsLine,startingLine)))

要为您定义范围可能 = INDIRECT(CONCATENATE($ sheet1。$ A $,起始线,:$ A $ 4))

例如总和(在excel中) = SUM((INDIRECT(CONCATENATE $ A $,startingLine:$ A $ 4))))但我不熟悉libreoffice中的定义范围


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 with value 1. For this mockup purpose, let's call it startingLine.

Both objects are properly defined in the Define Names dialog (shortcut: Ctrl+F3).

What I would like to do is to turn the lines of the defined range into variables. In my mind, all it'd take would be to define it like this: $Sheet1.$A$startingLine:$A$4, but this doesn't work. :-/

I'm looking for a simple spreadsheet solution, unfortunately macros won't do it for me this time. A solution using R1C1 reference would be good enough, though. :)

Any help will be greatly appreciated!

解决方案

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

这篇关于如何在Calc(或Excel)上定义动态范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 16:29