Issue 104761 - CURRENT() does not seem to work inside nested functions
Summary: CURRENT() does not seem to work inside nested functions
Alias: None
Product: Calc
Classification: Application
Component: editing (show other issues)
Version: OOO310m18
Hardware: PC Linux, all
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2009-09-03 15:31 UTC by smls
Modified: 2013-03-25 11:32 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: 3.4.1
Developer Difficulty: ---


Note You need to log in before you can comment on or make changes to this issue.
Description smls 2009-09-03 15:31:19 UTC
The OOCalc formula function CURRENT() does work when it is used as an argument
for another function, but not when that function is itself an argument for a
third function.

For example, the following two formulae produce exactly the same output, as one
should expect (with B1 holding a number, and A1:A5 a list of five numbers sorted
in ascending order):

=      MATCH( B1;        A1:A5 )
= B1 + MATCH( CURRENT(); A1:A5 ) - B1

Similarly, one should also expect the following two formulae to produce the same
output as each other:

=      INDEX( A1:A5; MATCH( B1;        A1:A5 ))
= B1 + INDEX( A1:A5; MATCH( CURRENT(); A1:A5 )) - B1

However, while the first one returns the proper value from the list A1:A5, the
second one causes a #VALUE! error.

The simple example given is of course rather useless, but I do have a
spreadsheet where I would like to set conditional STYLE() values depending on
rather complex value lookups based on the CURRENT() cell value, which this bug
seems to unfortunately make impossible.
Comment 1 Edwin Sharp 2013-03-25 10:46:29 UTC
The fourth item in description returns 1 for no apparent reason.
Rev. 1400866
Comment 2 Regina Henschel 2013-03-25 11:32:55 UTC
"based on the CURRENT() cell value"
CURRENT() is not the cell value, but it is the intermediate calculation result while calculating the formula. And I'm not sure about the internal order of calculation in case of function INDEX. For example
 =INDEX( A1:A5; B1+MATCH( CURRENT(); A1:A5 )-B1)
will work.

I guess, that you can use a total different and easier way to get your goal. You should discuss the problem in a mailing list or forum.