34
LECTURE 10 : LECTURE 10 : EXCEL FORMULAS AND EXCEL FORMULAS AND FUNCTIONS FUNCTIONS If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is.—John Louis von Neumann

Lect11

Embed Size (px)

Citation preview

Page 1: Lect11

LECTURE 10 : LECTURE 10 : EXCEL FORMULAS AND EXCEL FORMULAS AND

FUNCTIONSFUNCTIONS

If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is.—John Louis von Neumann

Page 2: Lect11

LECTURE LAYOUTLECTURE LAYOUTLECTURE LAYOUTLECTURE LAYOUT

LECTURE OUTCOMESLECTURE OUTCOMES

I. INTRODUCTIONI. INTRODUCTION

II. FILTER & SORTII. FILTER & SORT

III. FORMULAS AND FUNCTIONSIII. FORMULAS AND FUNCTIONS1. String Functions1. String Functions

CHAR(), LEN(),CHAR(), LEN(), and and CONCATENATE()CONCATENATE()

2. Numeric/Mathematical Functions2. Numeric/Mathematical Functions

COUNT(), COUNTA(), COS(), EXP(), IF()COUNT(), COUNTA(), COS(), EXP(), IF()

SUMIF(), SUMIFS(), SUMSQ(), FDIST(), FINV()SUMIF(), SUMIFS(), SUMSQ(), FDIST(), FINV()

Page 3: Lect11

LECTURE OUTCOMESLECTURE OUTCOMESAfter mastering materials of the present lecture, After mastering materials of the present lecture, students should be able to students should be able to

1.1. Demonstrate how and when Demonstrate how and when to filter data to filter data columns, columns, including how including how to select to select what to display or hide in what to display or hide in cells within the filtered range. cells within the filtered range.

2.2. Demonstrate how Demonstrate how to sort ranges of data to sort ranges of data in various in various orders, custom and predetermined, vertically and orders, custom and predetermined, vertically and horizontally. horizontally.

3.3. Demonstrate how Demonstrate how to use formulas to use formulas as arguments to as arguments to functions and other functions as arguments to functions and other functions as arguments to functions. Examples of function use include functions. Examples of function use include CHAR()CHAR(), , LEN()LEN(), , CONCATENATE()CONCATENATE(), , COUNT()COUNT(), , COUNTA()COUNTA(), , COS()COS(), , EXP()EXP(), , IF()IF(), , SUMIF()SUMIF(), , SUMIFS()SUMIFS(), , FDIST()FDIST(), , and and FINV()FINV()

Page 4: Lect11

MESSAGESMESSAGESYou have toYou have to1.1. learn (study) what you want to know learn (study) what you want to know

((knowledgeknowledge))

2.2. to understand what you have learnt, and be to understand what you have learnt, and be able to explain what you have understood able to explain what you have understood ((comprehensioncomprehension) ) (read the lecture notes and other sources, and (read the lecture notes and other sources, and

listen carefully to the explanation in the lectures)listen carefully to the explanation in the lectures)

3.3. be able to apply what you have been able to be able to apply what you have been able to explain (explain (applicationapplication) )

Page 5: Lect11

4.4. be able to make analysis on what you have be able to make analysis on what you have been able to apply for further development been able to apply for further development ((analysisanalysis))

5.5. be able to make sbe able to make synthesis of various ynthesis of various sources of information in the effort of sources of information in the effort of further development (further development (synthesissynthesis) )

6.6. be able to make ebe able to make evaluation on what you valuation on what you have done (have done (eevaluationvaluation))

7.7. develop positive attitude (develop positive attitude (affective affective learninglearning))

8.8. develop entrepreneurship capability develop entrepreneurship capability ((psychomotor learningpsychomotor learning))

Page 6: Lect11

INTRODUCTIONINTRODUCTION FORMULAFORMULA

A formulaA formula,, in science, is a concise way of expressing in science, is a concise way of expressing information symbolically as in a mathematical or information symbolically as in a mathematical or chemical formula.chemical formula.

For example, determining the volume of a sphere requires a For example, determining the volume of a sphere requires a significant amount of integral calculus or its geometrical significant amount of integral calculus or its geometrical analogue, the method of exhaustionanalogue, the method of exhaustion

Having done this once, mathematicians can produce a Having done this once, mathematicians can produce a formula to describe the volume in terms of some other formula to describe the volume in terms of some other parameter (the radius for example) as followsparameter (the radius for example) as follows

VV = 4/3 π = 4/3 π rr33

A formula is a special type of equation that shows the A formula is a special type of equation that shows the relationship between different variables relationship between different variables

Page 7: Lect11

Formulas can range from Formulas can range from basic mathematical basic mathematical operations operations - such as addition and subtraction - to - such as addition and subtraction - to complex engineering and statistical calculations.complex engineering and statistical calculations.

A formula in a spreadsheet is an instruction to carry A formula in a spreadsheet is an instruction to carry out some activity. out some activity.

For example For example Tot = 5 + 7 + …+ 20Tot = 5 + 7 + …+ 20

A formula allows the spreadsheet to perform A formula allows the spreadsheet to perform automatic calculations based on values in other cells automatic calculations based on values in other cells and to display the result. and to display the result.

FUNCTIONFUNCTION Spreadsheet programs also contain a number of built Spreadsheet programs also contain a number of built

in formulas called in formulas called functionsfunctions.. A A function is a predefined formulafunction is a predefined formula that performs that performs

calculations using specific values in a particular order. calculations using specific values in a particular order.

Page 8: Lect11

The function name tells Excel what calculation to The function name tells Excel what calculation to perform. The arguments are contained inside round perform. The arguments are contained inside round brackets.brackets.

For example: For example: = SUM()= SUM() One of the key benefits of functions is that they can One of the key benefits of functions is that they can

save you time since you do not have to write the save you time since you do not have to write the formula yourself. formula yourself. For example, you could use For example, you could use

an Excel function called an Excel function called STDEVSTDEV to quickly find the to quickly find the standard deviation of a range standard deviation of a range of numbers.of numbers.

Page 9: Lect11

FILTER & SORTFILTER & SORT Data OrganizationData Organization

When working on a worksheet with many rows of When working on a worksheet with many rows of data, it can be difficult to view and analyse the data, it can be difficult to view and analyse the data easily. data easily. 1.1. Filtering is a quick and easy way to find and work with Filtering is a quick and easy way to find and work with

a subset of data in an Excel range. a subset of data in an Excel range.

2.2. Filters enable you to quickly find all the entries for a Filters enable you to quickly find all the entries for a particular item, e.g. an employee name or a product, particular item, e.g. an employee name or a product, in a large worksheet. in a large worksheet.

3.3. Filters allow you to select just the data you need, and Filters allow you to select just the data you need, and to hide any data that is not relevant to your search. to hide any data that is not relevant to your search.

Page 10: Lect11

4.4. Unlike sorting, filtering does not rearrange your data, Unlike sorting, filtering does not rearrange your data, it simply hides the rows you don’t want. This will allow it simply hides the rows you don’t want. This will allow you to then edit, format, chart and print your filtered you to then edit, format, chart and print your filtered data as you wish.data as you wish.

Preparing to filter Preparing to filter Ensure the data in your worksheet is Ensure the data in your worksheet is neatneat and and tidy tidy

and you will find filtering easy. The following steps are and you will find filtering easy. The following steps are useful to prepare data: useful to prepare data:

Use headingsUse headings. . The top row of each column should The top row of each column should have a heading. have a heading.

Don’t mix the dataDon’t mix the data. . The data in a column should all The data in a column should all be the same type – don’t mix be the same type – don’t mix texttext and and numbersnumbers. .

Don’t interruptDon’t interrupt. . Don’t have Don’t have blank rows blank rows or or columnscolumns. . Individual blank cells are OK. Individual blank cells are OK.

Page 11: Lect11

Filtering Steps Filtering Steps 1.1. Click inside a table, and then choose Filter in the Sort Click inside a table, and then choose Filter in the Sort

& Filter group of the Data tab (or press & Filter group of the Data tab (or press Ctrl+Shift+LCtrl+Shift+L))

Page 12: Lect11

2.2. Click the filter arrow beside the column heading for the Click the filter arrow beside the column heading for the column you want to filter.column you want to filter.

3.3. Excel displays a drop-down list, which includes one of Excel displays a drop-down list, which includes one of each unique entry from the selected column.each unique entry from the selected column.

4.4. Remove the check mark from Select All (All items in Remove the check mark from Select All (All items in the list are deselected).the list are deselected).

5.5. Select the check Select the check box for the entry box for the entry you want to filter you want to filter and then click OKand then click OK

Page 13: Lect11

Data SortingData Sorting Sorting data is an integral part of data analysis. Data Sorting data is an integral part of data analysis. Data

can be sorted by text (A to Z or Z to A), numbers can be sorted by text (A to Z or Z to A), numbers (smallest to largest or largest to smallest), and dates (smallest to largest or largest to smallest), and dates and times (oldest to newest and newest to oldest) in and times (oldest to newest and newest to oldest) in one or more columns. one or more columns.

Data can be sorted by a custom list (such as Large, Medium, and Small) or by format, including cell color, font color, or icon set.

Most sort operations are Most sort operations are column sorts, but you column sorts, but you can also sort by rows.can also sort by rows.

Page 14: Lect11

FORMULAS & FUNCTIONSFORMULAS & FUNCTIONS MS Excel: ALL Functions (MS Excel: ALL Functions (297297) - Category) - Category

http://www.techonthenet.com/excel/formulas/

1.1. String Functions (String Functions (3939))

2.2. Numeric/Mathematical Numeric/Mathematical Functions (Functions (9191))

3.3. Statistical Functions Statistical Functions ((4242))

4.4. Logical Functions (Logical Functions (1212))

5.5. Information Functions Information Functions ((1818))

6.6. Date / Time Functions Date / Time Functions ((2626))

7.7. Database Functions Database Functions ((1212))

8.8. Data Type Conversion Data Type Conversion Functions (Functions (1111))

9.9. Financial Functions Financial Functions ((2020))

10.10. File/Directory File/Directory Functions (Functions (99))

11.11. Lookup/Reference Lookup/Reference Functions (Functions (1717))

Page 15: Lect11

1. String Functions1. String Functions

1. ASC (VBA)2. CHAR (WS)3. CHR (VBA)4. CLEAN (WS)5. CODE (WS)6. Concat with &

(WS, VBA)7. CONCATENATE

(WS)8. CURDIR (VBA)9. DOLLAR (WS)10. EXACT (WS)11. FIND (WS)12. FIXED (WS)13. FORMAT Strings

(VBA)

14. INSTR (VBA)15. INSTRREV (VBA)16. LCASE (VBA)17. LEFT (WS, VBA)18. LEN (WS, VBA)19. LOWER (WS)20. LTRIM (VBA)21. MID (WS, VBA)22. PROPER (WS)23. REPLACE (WS,

VBA)24. REPT (WS)25. RIGHT (WS, VBA)

26. RTRIM (VBA)27. SEARCH (WS)28. SPACE (VBA)29. STR (VBA)30. STRCONV (VBA)31. SUBSTITUTE

(WS)32. T (WS)33. TEXT (WS)34. TRIM (WS, VBA)35. UCASE (VBA)36. UPPER (WS)37. VAL (VBA)38. VALUE (WS)

Note: (WS) = Worksheet function, (VBA) = Visual Basic for Applications function

Page 16: Lect11

2. Numeric / Mathematical Functions2. Numeric / Mathematical Functions

1. ABS (WS, VBA)2. ACOS (WS)3. ACOSH (WS)4. AGGREGATE (WS)5. ASIN (WS)6. ASINH (WS)7. ATAN (WS)8. ATAN2 (WS)9. ATANH (WS)10. ATN (VBA)11. AVERAGE (WS)12. AVERAGEA (WS)13. AVERAGEIF (WS)14. AVERAGEIFS (WS)15. BIN2DEC (WS)16. BIN2HEX (WS)17. BIN2OCT (WS)18. CEILING (WS)19. CEILING.PRECISE

(WS)20. COMBIN (WS)21. COMBINA (WS)22. COMPLEX (WS)23. CONVERT (WS)24. COS (WS, VBA)25. COSH (WS)

26. COUNT (WS)27. COUNTA (WS)28. COUNTBLANK (WS)29. COUNTIF (WS)30. COUNTIFS (WS)31. DEGREES (WS)32. EVEN (WS)33. EXP (WS, VBA)34. FACT (WS)35. FIX (VBA)36. FLOOR (WS)37. FORMAT Numbers

(VBA)38. FREQUENCY (WS)39. INT (WS, VBA)40. LARGE (WS)41. LINEST (WS)42. LN (WS)43. LOG (WS, VBA)44. LOG10 (WS)45. MAX (WS)46. MAXA (WS)47. MDETERM (WS)48. MEDIAN (WS)49. MIN (WS)50. MINA (WS)

51. MINVERSE (WS)52. MMULT (WS)53. MOD (WS)54. N (WS)55. ODD (WS)56. PI (WS)57. POWER (WS)58. PRODUCT (WS)59. RADIANS (WS)60. RAND (WS)61. RANDBETWEEN

(WS)62. RND (VBA)63. ROUND (WS)64. ROUND (VBA)65. ROUNDDOWN (WS)66. ROUNDUP (WS)67. SGN (VBA)68. SIGN (WS)69. SIN (WS, VBA)70. SINH (WS)71. SMALL (WS)72. SQRT (WS)73. SUBTOTAL (WS)74. SUM (WS)75. ROMAN (WS)

76. SUMIF (WS)77. SUMIFS (WS)78. SUMPRODUCT (WS)79. SUMSQ (WS)80. SUMX2MY2 (WS)81. SUMX2PY2 (WS)82. SUMXMY2 (WS)83. TAN (WS, VBA)84. TANH (WS)85. TRUNC (WS)86. VAL (VBA)87. VALUE (WS)88. VAR (WS)89. VARA (WS)90. VARP (WS)91. VARPA (WS)

Page 17: Lect11

1. String Functions1. String Functions1.1. CHARCHAR

2.2. LENLEN

3.3. CONCATENATECONCATENATE

1. CHAR1. CHAR This function is used to return the character specified by This function is used to return the character specified by

a number. a number. All characters that are available for use on a computer All characters that are available for use on a computer

have been assigned a number. Unfortunately, not all have been assigned a number. Unfortunately, not all computers use the same numbering system or computers use the same numbering system or codecode when numbering the different characters.when numbering the different characters.

Page 18: Lect11

The syntaxThe syntax

= CHAR (Number)= CHAR (Number) NumberNumber is a number between 1 and 255 specifying is a number between 1 and 255 specifying

which character you want. The character is from the which character you want. The character is from the character set used by your computer.character set used by your computer.

Windows computers use the Windows computers use the ANSIANSI code system. ANSI code system. ANSI is short for is short for American National Standards InstituteAmerican National Standards Institute..

The opposite of CHAR function is CODE functionThe opposite of CHAR function is CODE function

Page 19: Lect11

2. LEN2. LENThis This function is used to count the number of characters in a function is used to count the number of characters in a

cellcellThe syntaxThe syntax

=LEN(text)=LEN(text)

Space between two characters is also considered as Space between two characters is also considered as characterscharacters

Page 20: Lect11

CONCATENATECONCATENATE This function is used to join up to 255 text strings into This function is used to join up to 255 text strings into

one text stringone text string The syntaxThe syntax

=CONCATENATE(Text1,Text2,Text3,…)=CONCATENATE(Text1,Text2,Text3,…) The symbol & can be also used to joint several texts The symbol & can be also used to joint several texts

into one text string. This function may be of great into one text string. This function may be of great importance to reorganize texts copied from PDF fileimportance to reorganize texts copied from PDF file

Page 21: Lect11

2. Numeric/Mathematical Functions2. Numeric/Mathematical Functions1.1. COUNT & COUNTACOUNT & COUNTA

2.2. COSCOS

3.3. EXPEXP

4.4. IFIF

5.5. SUMIFSUMIF

6.6. SUMIFSSUMIFS

7.7. SUMSQSUMSQ

8.8. FDISTFDIST

9.9. FINVFINV

Page 22: Lect11

1. COUNT & COUNTA1. COUNT & COUNTA This function is used to count the number of cells that This function is used to count the number of cells that

contain numbers, and counts numbers within the list contain numbers, and counts numbers within the list of arguments. of arguments.

  

SyntaxSyntax

=COUNT(value1, [value2], ...) or COUNT(cell range)=COUNT(value1, [value2], ...) or COUNT(cell range) This is similar to the This is similar to the COUNTACOUNTA function that is used to function that is used to

count the number of cells that are not empty in a count the number of cells that are not empty in a range.range.

  

SyntaxSyntax

=COUNTA(value1, [value2], ...) or COUNTA(cell range)=COUNTA(value1, [value2], ...) or COUNTA(cell range)

Page 23: Lect11

2. COS2. COS This COS function is used to return the cosine of the This COS function is used to return the cosine of the

given angle.given angle.

SyntaxSyntax

=COS(number)=COS(number) The number is the angle in radian unit. An angle in The number is the angle in radian unit. An angle in

degree is converted to radian by multiplying it with degree is converted to radian by multiplying it with PI()/180, or use the RADIANS function to convert the PI()/180, or use the RADIANS function to convert the angle to radians.angle to radians.

=COS(PI()*angle/180) or =COS(RADIANS(angle))=COS(PI()*angle/180) or =COS(RADIANS(angle))

Page 24: Lect11

3. EXP3. EXP This function is used to return e raised to the power of This function is used to return e raised to the power of

number (enumber (exx). The constant e equals ). The constant e equals 2.71828182845904, the base of the natural logarithm.2.71828182845904, the base of the natural logarithm.

  

SyntaxSyntax

=EXP(number)=EXP(number) Number is the exponent applied to the base e.Number is the exponent applied to the base e.

Page 25: Lect11

4. IF4. IF This function is used to return one value if a condition This function is used to return one value if a condition

specified evaluates to TRUE, and another value if that specified evaluates to TRUE, and another value if that condition evaluates to FALSE. condition evaluates to FALSE.

  

SyntaxSyntax

=IF(logical_test, [value_if_true], [value_if_false])=IF(logical_test, [value_if_true], [value_if_false])

Page 26: Lect11
Page 27: Lect11

5. SUMIF5. SUMIF This This function is used to add the cells specified by This This function is used to add the cells specified by

a given criteria.a given criteria.  

SyntaxSyntax

=SUMIF(range,criteria,sum_range)=SUMIF(range,criteria,sum_range) RangeRange is the range of cells to be evaluated by criteria. is the range of cells to be evaluated by criteria. CriteriaCriteria is the criteria in the form of a number, is the criteria in the form of a number,

expression, or text that defines which cells will be expression, or text that defines which cells will be added. For example, criteria can be expressed as 32, added. For example, criteria can be expressed as 32, "32", ">32", or "apples“."32", ">32", or "apples“.

Page 28: Lect11

Sum_rangeSum_range are the actual cells to add if their are the actual cells to add if their corresponding cells in range match criteria. If corresponding cells in range match criteria. If sum_range is omitted, the cells in range are both sum_range is omitted, the cells in range are both evaluated by criteria and added if they match criteria.evaluated by criteria and added if they match criteria.

Page 29: Lect11

6. SUMIFS6. SUMIFS This function is used to add the cells in a range that This function is used to add the cells in a range that

meet multiple criteria. meet multiple criteria. The order of arguments differ between the The order of arguments differ between the

SUMIFSSUMIFS and and SUMIFSUMIF functions. In particular, functions. In particular, the the sum_rangesum_range argument is the first argument is the first argument in argument in SUMIFSSUMIFS, but it is the third , but it is the third argument in argument in SUMIFSUMIF..

  

SyntaxSyntax

=SUMIFS(sum_range, criteria_range1, criteria1, =SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2,criteria2], …)[criteria_range2,criteria2], …)

Page 30: Lect11

Jumlahkah hasil penjualan (C3:C16) jika itu adalah hasil penjulanan jagung (A3:A16) di Malang (B3:B16)

Page 31: Lect11

8. FDIST8. FDIST This function is used to return the F probability This function is used to return the F probability

distribution, and to determine whether two data sets distribution, and to determine whether two data sets have different degrees of diversity. have different degrees of diversity.

For example, you can examine the test scores of men and For example, you can examine the test scores of men and women entering high school and determine if the variability in women entering high school and determine if the variability in the females is different from that found in the males.the females is different from that found in the males.

  

SyntaxSyntax

=FDIST=FDIST((xx,,degrees_freedom1degrees_freedom1,,degrees_freedom2degrees_freedom2) ) probabilityprobability

XX is the value at which to evaluate the function. is the value at which to evaluate the function. Degrees_freedom1Degrees_freedom1 is the numerator degrees of is the numerator degrees of

freedom.freedom.

Page 32: Lect11

Degrees_freedom2Degrees_freedom2 is the denominator degrees of is the denominator degrees of freedom.freedom.

9. FINV9. FINV This function is used to get the inverse of the (right-This function is used to get the inverse of the (right-

tailed) F probability distribution. If p = FDIST(x,...), tailed) F probability distribution. If p = FDIST(x,...), then FINV(p,...) = x.then FINV(p,...) = x.

Page 33: Lect11

This function is still available at present, and the new This function is still available at present, and the new functions should be considered. For more information functions should be considered. For more information about the new functions, see F.INV function and about the new functions, see F.INV function and F.INV.RT function.F.INV.RT function.

SyntaxSyntax

= FINV(probability,deg_freedom1,deg_freedom2)= FINV(probability,deg_freedom1,deg_freedom2) The FINV function syntax has the following The FINV function syntax has the following

arguments:arguments: ProbabilityProbability Required. A probability associated with Required. A probability associated with

the F cumulative distribution.the F cumulative distribution. Deg_freedom1Deg_freedom1 Required. The numerator degrees of Required. The numerator degrees of

freedom.freedom. Deg_freedom2Deg_freedom2 Required. The denominator degrees Required. The denominator degrees

of freedom.of freedom.

Page 34: Lect11