emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

## Re: Bug: Can’t assign to hline relative reference

 From: Dante Catalfamo Subject: Re: Bug: Can’t assign to hline relative reference Date: Thu, 22 Oct 2020 19:56:53 +0000

```That seems to work for the most part, but now I'm experiencing a strange
difference when evaluating. If I use a formula like

#+TBLFM:@2\$3..@23\$3=if(\$2!=0,12*\$2,\$3);%.2f::@24\$2=vsum(@I..@II);%.2f::@24\$3=vsum(@I..@II);%.2f

The column gets evaluated first, then the sum at the bottom gets
evaluated, resulting in what I'd expect. But if I use a formula like

#+TBLFM:@<<\$3..@>>\$3=if(\$2!=0,12*\$2,\$3);%.2f::@24\$2=vsum(@I..@II);%.2f::@24\$3=vsum(@I..@II);%.2f

The sum gets calculated first, and the column after, meaning the sum
doesn't reflect any changes made before calculation. I find this pretty
strange considering the formulas are in the same order. Do formulas
involving relative references get calculated last for some reason?

On 2020-10-22 8:04 a.m., Maxim Nikulin wrote:
>
> Dante Catalfamo wrote:
>> In the case where I'm using this formula, there are many more rows
>> between @I..@II. I only used two in the example to keep the email small.
>> I would also be adding more rows regularly, making it slightly
>> impractical to be adjusting the beginning and end points of the formula
>> every time I add or remove a row. I appreciate your suggestion, though I
>> was hoping for a more convenient solution. If nothing else works, that's
>> what I'll do.
>
> You are not alone. From my point of view it is not clear enough from org
> manual that @I references could be used only to the right of "=". The
> error message was a bad surprize. Another similar pitfal was with named
> columns.
>
> However in some cases @<< (unlike @2 remains unchanged if a new line is
> added before second row) and @>> could be a workaround. If there are
> several horizontal lines, sometimes it is possible to mark particular
> lines with # and use e.g. \$3=vsum(@-I\$-1..@+I\$-1) to avoid proliferation
> of same formulas for each table section.
>
>

```

reply via email to

 [Prev in Thread] Current Thread [Next in Thread]