Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
00f4dea1
Commit
00f4dea1
authored
Jul 24, 2017
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring cAVERAGEIF
delete usage get cells
parent
8955a681
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
22 deletions
+17
-22
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+17
-22
No files found.
cell/model/FormulaObjects/statisticalFunctions.js
View file @
00f4dea1
...
...
@@ -52,6 +52,7 @@
var
cEmpty
=
AscCommonExcel
.
cEmpty
;
var
cArray
=
AscCommonExcel
.
cArray
;
var
cBaseFunction
=
AscCommonExcel
.
cBaseFunction
;
var
checkTypeCell
=
AscCommonExcel
.
checkTypeCell
;
var
cFormulaFunctionGroup
=
AscCommonExcel
.
cFormulaFunctionGroup
;
var
_func
=
AscCommonExcel
.
_func
;
...
...
@@ -1597,45 +1598,39 @@
}
arg1
=
arg1
.
toString
();
var
val
;
var
r
=
arg0
.
getRange
();
var
r2
=
arg2
.
getRange
();
ws
=
arg0
.
getWS
();
matchingInfo
=
AscCommonExcel
.
matchingValue
(
arg1
.
toString
());
if
(
cElementType
.
cellsRange
===
arg0
.
type
)
{
ws
=
arg0
.
getWS
();
var
tmpCellArg0
=
arg0
.
getRange
().
getCells
()[
0
],
tmpCellArg2
=
arg2
.
getRange
(),
offset
,
bbox
,
r2
;
arg0
.
foreach2
(
function
(
v
,
cell
)
{
if
(
matching
(
v
,
matchingInfo
))
{
offset
=
cell
.
getOffset
(
tmpCellArg0
);
tmpCellArg2
=
arg2
.
getRange
();
tmpCellArg2
.
setOffset
(
offset
);
bbox
=
tmpCellArg2
.
getBBox0
();
offset
.
offsetCol
*=
-
1
;
offset
.
offsetRow
*=
-
1
;
var
offset
=
cell
.
getOffset3
(
r
.
bbox
.
c1
+
1
,
r
.
bbox
.
r1
+
1
);
r2
.
setOffset
(
offset
);
r2
=
new
cRef
(
ws
.
getRange3
(
bbox
.
r1
,
bbox
.
c1
,
bbox
.
r1
,
bbox
.
c1
).
getName
(),
ws
);
var
val
=
checkTypeCell
(
ws
.
_getCellNoEmpty
(
r2
.
bbox
.
r1
,
r2
.
bbox
.
c1
)
);
tmpCellArg2
.
setOffset
(
offset
);
offset
.
offsetCol
*=
-
1
;
offset
.
offsetRow
*=
-
1
;
r2
.
setOffset
(
offset
);
if
(
cElementType
.
number
===
r2
.
getValue
()
.
type
)
{
_sum
+=
r2
.
getValue
()
.
getValue
();
if
(
cElementType
.
number
===
val
.
type
)
{
_sum
+=
val
.
getValue
();
_count
++
;
}
}
})
}
else
{
val
=
arg0
.
getValue
();
if
(
matching
(
val
,
matchingInfo
))
{
var
r
=
arg0
.
getRange
();
ws
=
arg0
.
getWS
();
var
r1
=
r
.
bbox
.
r1
,
c1
=
arg2
.
getRange
().
bbox
.
c1
;
r
=
new
cRef
(
ws
.
getRange3
(
r1
,
c1
,
r1
,
c1
).
getName
(),
ws
);
if
(
cElementType
.
number
===
r
.
getValue
().
type
)
{
_sum
+=
r
.
getValue
().
getValue
();
if
(
matching
(
arg0
.
getValue
(),
matchingInfo
))
{
var
val
=
checkTypeCell
(
ws
.
_getCellNoEmpty
(
r
.
bbox
.
r1
,
r2
.
bbox
.
c1
));
if
(
cElementType
.
number
===
val
.
type
)
{
_sum
+=
val
.
getValue
();
_count
++
;
}
}
}
if
(
_count
==
0
)
{
if
(
0
===
_count
)
{
return
new
cError
(
cErrorType
.
division_by_zero
);
}
else
{
return
this
.
value
=
new
cNumber
(
_sum
/
_count
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment