| Summary: | CountIf ? (german: ZÄHLENWENN) with regexp does not count correctly | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | Tom <tommyads> |
| Component: | Calc | Assignee: | Not Assigned <libreoffice-bugs> |
| Status: | RESOLVED NOTABUG | ||
| Severity: | normal | CC: | gerard.fargeot |
| Priority: | medium | ||
| Version: | 5.0.5.2 release | ||
| Hardware: | x86-64 (AMD64) | ||
| OS: | Linux (All) | ||
| Whiteboard: | |||
| Crash report or crash signature: | Regression By: | ||
| Attachments: | screenshot with formula and result in Cell K217 | ||
The 1st .* applies only to 1st criterion "mo" and the last to "my". Using parenthesis make the formula giving expected result : =ZÄHLENWENN($N217:$AD217;".*(mo|mw|ma|ml|mu|my).*") Thank you! Regexp ".*(mo|mw|ma|ml|mu|my).*" works fine! Hope this is explained in documentation/help ... The following comment is not too important (as it works with the above): still the behaviour seems to me not intuitive. In short: if ".*mo|mw|ma|ml|mu|my.*" matches ml why does it not match mlm as is the case? i.e., it only matches if the cell contains exactly ml and no character before nor any character thereafter. So ".*mo|mw|ma|ml|mu|my.*" seems to work exactly like "mo|mw|ma|ml|mu|my" (In reply to Tom from comment #2) > In short: if ".*mo|mw|ma|ml|mu|my.*" matches > ml > why does it not match > mlm > as is the case? > i.e., it only matches if the cell contains exactly ml and no character > before nor any character thereafter. > > So ".*mo|mw|ma|ml|mu|my.*" seems to work exactly like > "mo|mw|ma|ml|mu|my" No, this search matches: .*mo mw ma ml mu my.* Word ending with "mo", words beginning with "my" and exact match for others. "hel|hal.*" with find exact match "hel" and words beginning with "hal". Operator | (or) have priority. (.* applies only to "hal". While with "(hel|hal).*" will find "hell", "hello", "hallo", "hellish"... (With the grouping parenthesis, ".*" apllies to all the group.) |
Created attachment 124204 [details] screenshot with formula and result in Cell K217 Formula =ZÄHLENWENN($N217:$AD217;".*mo|mw|ma|ml|mu|my.*") does not count cells with following content ml,5 (option regexp. within formulas is switched on!) but does correctly count cells with content ml Something seems wrong.