GNOME Bugzilla – Bug 404095
we need g_countif, because we need a conditional, not a string!
Last modified: 2010-04-30 17:50:36 UTC
As seen today on IRC (#gnumeric): 16:01 < brick> here is a strange side effect, =countif(I$37:I$106,"<=E28") won't evaluate the E28... hrm 16:03 <@TreMobyl> indeedy 16:03 <@TreMobyl> bugzilla it 16:03 < brick> well, i think i can see why the string doesn't get variable evaluation... perhaps there is a concatenaty way to assemble the string in advance 16:05 < brick> gnumeric can do string manipulation, i assume... reading up... 16:06 <@TreMobyl> yes 16:06 <@TreMobyl> is still one too many hoops for my taste 16:06 <@TreMobyl> I mean, the formula you pasted should work if it's in another setting. 16:06 < brick> i'm reluctant to call it a bug, actually 16:07 <@TreMobyl> true, it is a string. 16:07 < brick> the "<=val" API is sketchy and causes this side effect 16:07 <@TreMobyl> Although the IF would imply that it's not a string but a conditional expression, which it (arguably) ought to be. 16:07 < brick> definitely easier in some programming languages 16:05 < brick> gnumeric can do string manipulation, i assume... reading up... 16:06 <@TreMobyl> yes 16:06 <@TreMobyl> is still one too many hoops for my taste 16:06 <@TreMobyl> I mean, the formula you pasted should work if it's in another setting. 16:06 < brick> i'm reluctant to call it a bug, actually 16:07 <@TreMobyl> true, it is a string. 16:07 < brick> the "<=val" API is sketchy and causes this side effect 16:07 <@TreMobyl> Although the IF would imply that it's not a string but a conditional expression, which it (arguably) ought to be. 16:07 < brick> definitely easier in some programming languages 16:07 < brick> totally agreed 16:07 <@TreMobyl> I suspect that this is Excel-Compatible, though. 16:07 < brick> that could be a nice enhancement 16:08 <@TreMobyl> * This function is Excel compatible. 16:08 <@TreMobyl> 16:08 < brick> :/ 16:08 <@TreMobyl> looks like we would need a G_COUNTIF 16:09 <@TreMobyl> confirmed with XL2003 16:10 < brick> ahh 16:10 <@TreMobyl> behaves exactly like gnumeric does. No string as an error, no cell expansion in the string. 16:10 <@TreMobyl> and MS Office won't let me quit until I fix the error. LAME! 16:10 < brick> i got the whole question answered with =countif(I$37:I$106,concatenate("<=",E29)) - the number of years prior to the fund's meeting a certain level. 16:10 < brick> yikes 16:10 <@TreMobyl> yes, but that is stupid. :) 16:11 < brick> hah 16:11 <@TreMobyl> should have a g_countif that actuall uses a conditional, not a string I therefore propose a new, gnumeric-specific function, namely g_countif where the condition is a *conditional* not a string!
I would be willing to implement this this upcoming week, if I can get some help with it (and if it wouldn't be too invasive a change).
You want to avoid naming a dependent inside a string. Have it as a separate argument, i.e., instead of =countif(I$37:I$106,concatenate("<=",E29)) you should do =countif(I$37:I$106,"<=",E29)
WONTFIX since it wouldn't play well with other spreadsheets. This can be done with implicit iteration. That also can be used with multiple criteria and functions other than SUM and COUNT.