summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2018-05-09 10:40:03 +0200
committerCaolán McNamara <caolanm@redhat.com>2018-05-11 09:59:31 +0200
commit9b2ebcfe80900b2f6299851d3a271bdcaa85049a (patch)
treecbad2c534e0f3658f66398fd65330e4fabe11f2e
parent33af02a486ee911ba68608ec6f4f0b06dd742473 (diff)
tdf#117433 count empty cells properly with COUNTIF.
All empty columns after the first column of the range were skipped. When the query contains an 'cell is empty' expression, skipping is omitted. Change-Id: I0d5b0d24c2d08bad88479cd5b356529a0a709156 Reviewed-on: https://gerrit.libreoffice.org/54021 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 1a8febcaa4f932124d417877a3b08bd059c0362d) Reviewed-on: https://gerrit.libreoffice.org/54037 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/qa/unit/data/functions/statistical/fods/countif.fods22
-rw-r--r--sc/source/core/data/dociter.cxx2
2 files changed, 18 insertions, 6 deletions
diff --git a/sc/qa/unit/data/functions/statistical/fods/countif.fods b/sc/qa/unit/data/functions/statistical/fods/countif.fods
index 557e70b2044f..8625ebe7aeff 100644
--- a/sc/qa/unit/data/functions/statistical/fods/countif.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/countif.fods
@@ -3865,10 +3865,22 @@
<table:table-cell table:style-name="ce58"/>
</table:table-row>
<table:table-row table:style-name="ro6">
- <table:table-cell table:number-columns-repeated="2"/>
- <table:table-cell table:style-name="ce28"/>
- <table:table-cell table:style-name="ce34"/>
- <table:table-cell table:number-columns-repeated="2"/>
+ <table:table-cell table:formula="of:=COUNTIF([.P20:.R23];&quot;&quot;)" office:value-type="float" office:value="12" calcext:value-type="float">
+ <text:p>12</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="12" calcext:value-type="float">
+ <text:p>12</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="ce64" table:formula="of:=ROUND([.A32];12)=ROUND([.B32];12)" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
+ <text:p>TRUE</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="ce34" table:formula="of:=FORMULA([.A32])" office:value-type="string" office:string-value="=COUNTIF(P20:R23,&quot;&quot;)" calcext:value-type="string">
+ <text:p>=COUNTIF(P20:R23,&quot;&quot;)</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="string" calcext:value-type="string">
+ <text:p>tdf#117433</text:p>
+ </table:table-cell>
+ <table:table-cell/>
<table:table-cell table:style-name="ce39"/>
<table:table-cell/>
<table:table-cell office:value-type="float" office:value="3" calcext:value-type="float">
@@ -4469,4 +4481,4 @@
</table:named-expressions>
</office:spreadsheet>
</office:body>
-</office:document> \ No newline at end of file
+</office:document>
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 96af2dbc3150..689abc31d07a 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1144,7 +1144,7 @@ bool ScQueryCellIterator::GetThis()
}
pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
}
- while (pCol->IsEmptyData());
+ while (!rItem.mbMatchEmpty && pCol->IsEmptyData());
InitPos();