GNOME Bugzilla – Bug 149945
dsum function misbehaving
Last modified: 2004-12-22 21:47:04 UTC
function dsum(database,field,criteria) When my database has more than 10 fields and "field" is used to reference e.g. field 14. then the dsum is not correctly calculated. To get the total of field 14 (first field in database taken as 0) it is necessary to enter the field as 3 instead of 14. If the field label is used instead of the field number then the calculation is correct.
Please give us a concreate example of the type A1=42 A2=14 ... A22=dsum(...) or a test sheet that shows a specific formula that misbehaves. Also please let us know what cell contains a wrong answer *and* what the right one is.
I can't quite get that example to work but a similar situation is exposed in the following gnumeric file. I believe the correct value in A5 should be 1, not 13.
Created attachment 30735 [details] testcase
This bug is not specific to dsum. Dcount is similarly misbehaving: in the test sheet edit A5 to use dcount rather than dsum. Delete the content of M2. A5 now shows 0 but should show 1.
oh, my test cases show the bug in current cvs. I haven't tried 1.2.x.
fixed in cvs HEAD (I guess specifying column numbers was never tested.) I am attaching a patch and leave this report open to facilitate backporting to 1.2.x if desired.
Created attachment 30815 [details] [review] patch already committed to HEAD
Feel free to apply to 1.2, at this point I'm not planning to release 1.2.14, but it can't hurt.
backported to 1.2.x