From 9077a2887221677690282917c66c7af8e3e37121 Mon Sep 17 00:00:00 2001 From: Steve Fanning Date: Fri, 5 Nov 2021 12:28:17 +0200 Subject: Improve Example section of help description for Calc's SUM() function The ability to use SUM in an array formula is important but the help description of an example array formula is uncharacteristically long. Now that the wiki has a more specific example, it is appropriate to shorten the Example section of this help topic. Also moved SUM description to its own XHP file. Change-Id: Ic062686c53a1ae8b81100e2b49781aaa79e6ee50 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/124696 Tested-by: Jenkins Reviewed-by: Eike Rathke Reviewed-by: Olivier Hallot --- AllLangHelp_scalc.mk | 1 + source/text/scalc/01/04060106.xhp | 15 ++++-------- source/text/scalc/01/func_sum.xhp | 48 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 source/text/scalc/01/func_sum.xhp diff --git a/AllLangHelp_scalc.mk b/AllLangHelp_scalc.mk index 0bc4bd0cdb..617223bfed 100644 --- a/AllLangHelp_scalc.mk +++ b/AllLangHelp_scalc.mk @@ -253,6 +253,7 @@ $(eval $(call gb_AllLangHelp_add_helpfiles,scalc,\ helpcontent2/source/text/scalc/01/func_second \ helpcontent2/source/text/scalc/01/func_skewp \ helpcontent2/source/text/scalc/01/func_searchb \ + helpcontent2/source/text/scalc/01/func_sum \ helpcontent2/source/text/scalc/01/func_sumifs \ helpcontent2/source/text/scalc/01/func_switch \ helpcontent2/source/text/scalc/01/func_textjoin \ diff --git a/source/text/scalc/01/04060106.xhp b/source/text/scalc/01/04060106.xhp index acd376eae9..a245b9d28f 100644 --- a/source/text/scalc/01/04060106.xhp +++ b/source/text/scalc/01/04060106.xhp @@ -1033,16 +1033,11 @@ -If you enter the numbers 2; 3 and 4 in the Number 1; 2 and 3 text boxes, 9 will be returned as the result. -=SUM(A1;A3;B5) calculates the sum of the three cells. =SUM (A1:E10) calculates the sum of all cells in the A1 to E10 cell range. -Conditions linked by AND can be used with the function SUM() in the following manner: -Example assumption: You have entered invoices into a table. Column A contains the date value of the invoice, column B the amounts. You want to find a formula that you can use to return the total of all amounts only for a specific month, e.g. only the amount for the period >=2008-01-01 to <2008-02-01. The range with the date values covers A1:A40, the range containing the amounts to be totaled is B1:B40. C1 contains the start date, 2008-01-01, of the invoices to be included and C2 the date, 2008-02-01, that is no longer included. -Enter the following formula as an array formula: -=SUM((A1:A40>=C1)*(A1:A40<C2)*B1:B40) -In order to enter this as an array formula, you must press the Shift+Command -+ Ctrl+ Enter keys instead of simply pressing the Enter key to close the formula. The formula will then be shown in the Formula bar enclosed in braces. -{=SUM((A1:A40>=C1)*(A1:A40<C2)*B1:B40)} -The formula is based on the fact that the result of a comparison is 1 if the criterion is met and 0 if it is not met. The individual comparison results will be treated as an array and used in matrix multiplication, and at the end the individual values will be totaled to give the result matrix. +=SUM(2;3;4) returns 9. +=SUM(A1;A3;B5) calculates the sum of the three cells. +=SUM(A1:E10) calculates the sum of all cells in the A1 to E10 cell range. +A formula such as =SUM((A1:A40>=C1)*(A1:A40<C2)*B1:B40) may be entered as an array formula by pressing the Shift+Command+Ctrl+Enter keys instead of simply pressing the Enter key to finish entering the formula. The formula will then be shown in the Formula bar enclosed in braces and operates by multiplying corresponding elements of the arrays together and returning their sum. +Refer to the SUM wiki page for more details about this function.
diff --git a/source/text/scalc/01/func_sum.xhp b/source/text/scalc/01/func_sum.xhp new file mode 100644 index 0000000000..389c0bcc48 --- /dev/null +++ b/source/text/scalc/01/func_sum.xhp @@ -0,0 +1,48 @@ + + + + + + + SUM Function + /text/scalc/01/func_sum.xhp + + + +
+ + + SUM function + adding;numbers in cell ranges + +

SUM

+ Adds a set of numbers. +
+ + + SUM() + + + + =SUM(2;3;4) returns 9. + =SUM(A1;A3;B5) calculates the sum of the three cells. + =SUM(A1:E10) calculates the sum of all cells in the A1 to E10 cell range. + A formula such as =SUM((A1:A40>=C1)*(A1:A40<C2)*B1:B40) may be entered as an array formula by pressing the Shift+Command+Ctrl+Enter keys instead of simply pressing the Enter key to finish entering the formula. The formula will then be shown in the Formula bar enclosed in braces and operates by multiplying corresponding elements of the arrays together and returning their sum. + Refer to the SUM wiki page for more details about this function. + +
+ + , + + +
+ + +
\ No newline at end of file -- cgit