KDE Bug Tracking System
Home
Report New Wish or Bug
Query Existing Reports
First
Last
Prev
Next
No search results available
Search page
Bug
127411
:
Lookup function only returns last value
P
roduct
:
kspread
Co
m
ponent
:
general
Status
:
RESOLVED
Resolution
:
FIXED
Target
:
---
Version
:
unspecified
Pr
i
ority
:
NOR
Severity
:
normal
V
otes
:
20
Description
:
Opened:
2006-05-16 01:58
Last Changed:
2008-03-04 07:25:18
Version: 1.5.0 (using KDE 3.5.2 Level "a" , SUSE 10.0 UNSUPPORTED) Compiler: Target: i586-suse-linux OS: Linux (i686) release 2.6.13-15.8-default The lookup function always returns the last value in the results vector regardless of the search value. i.e. formula(s) like D1 - lookup(C1,$A$1:$A3;$B$1:$B$3) Results: COL/Row: a b c d Expected: D 1 11 300 12 222 75 2 12 75 cat 222 ERR 3 13 222 11 222 300
Comment
#1
John Gutierrez 2006-08-03 19:55:05
That comma in the example formula should be a semi-colon. NOTE: The LOOKUP syntax in pop-up guide under the insert menu shows "lookup(0,0,0)" The syntax example should show the correct delimiter. i.e. "Syntax: LOOKUP(0;0;0".
Comment
#2
Sebastian Sauer 2006-08-19 12:50:59
At least the syntax-example is fixed now (as in , got replaced with ; ). Thanks for that hint.
Comment
#3
Stefan Nikolaus 2006-10-03 22:12:28
SVN commit 592093 by nikolaus: Functions Fix "LOOKUP function only returns last value". BUG: 127411 M +3 -3 branches/koffice/1.6/koffice/kspread/kspread_functions_reference.cc M +2 -2 trunk/koffice/kspread/functions/reference.cpp --- branches/koffice/1.6/koffice/kspread/kspread_functions_reference.cc #592092:592093 @@ -253,15 +253,15 @@ unsigned rows = lookup.rows(); if ((cols != rr.columns()) || (rows != rr.rows())) return Value::errorVALUE(); - Value res; - + Value res = Value::errorNA(); + // now traverse the array and perform comparison for (unsigned r = 0; r < rows; ++r) for (unsigned c = 0; c < cols; ++c) { // update the result, return if we cross the line Value le = lookup.element (c, r); - if (calc->lower (lookup, le) || calc->equal (lookup, le)) + if (calc->lower (le, num) || calc->equal (num, le)) res = rr.element (c, r); else return res; --- trunk/koffice/kspread/functions/reference.cpp #592092:592093 @@ -252,7 +252,7 @@ unsigned rows = lookup.rows(); if ((cols != rr.columns()) || (rows != rr.rows())) return Value::errorVALUE(); - Value res; + Value res = Value::errorNA(); // now traverse the array and perform comparison for (unsigned r = 0; r < rows; ++r) @@ -260,7 +260,7 @@ { // update the result, return if we cross the line Value le = lookup.element (c, r); - if (calc->lower (lookup, le) || calc->equal (lookup, le)) + if (calc->lower (le, num) || calc->equal (num, le)) res = rr.element (c, r); else return res;
Comment
#4
John Gutierrez 2008-03-04 07:25:18
The example is still misleading. I can't think of a case where the lookup and results vectors will change. Lookup implies some kind of a "fixed table". The example should reflect the fixed position of the table. i.e., LOOKUP(C1;$A$1:$A$3;$B$1:$B$3) Otherwise, I would be interested in seeing an example of a "floating lookup table".
P
latform
:
unspecified
O
S
:
Linux
K
eywords
:
People
Reporter
:
John Gutierrez
Assigned To
:
Laurent Montel
Related actions
View Bug Activity
Format For Printing
XML
Clone This Bug
Note
You need to
log in
before you can comment on or make changes to this bug.
Attachments
Add an attachment
(proposed patch, testcase, etc.)
Depends on
:
B
locks
:
Show dependency tree
-
Show dependency graph
First
Last
Prev
Next
No search results available
Search page
Actions
Reports
Requests
Reports
Bugs reported today
Bugs reported in the last 3 days
Bug reports with patches
Weekly Bug statistics
The most hated bugs
The most severe bugs
The most frequently reported bugs
The most wanted features
Junior Jobs
Report ownership counts and charts
My Account
New Account
Log In