Statistical functions Data validation Conditional formatting
Vlookup, Hlookup, print table, solver
What if analysis
Data table, what if, goal seek analysis
Basic mathematical functions • Adds a bunch of numbers • Syntax of Sum formula: sum(add this, [and this ..])
Examples of Excel Sum formula:
sum(1,2,3,4) = 10 sum(5.6,2.3) = 7.9 Basic Mathematical functions • Average Formula • Syntax of Average formula: average(of this number, [and this number too..])
Examples of Excel Average formula:
average(2,4,6) = 4 average(A1:A5) = average of numbers in A1:A5
Mod Formula Rand Formula Round Formula Sum Formula Basic mathematical functions • Int Formula
• Converts a decimal number to integer lower than it
• Syntax of Int formula: int(this number)
Examples of Excel Int formula:
int(1.2365) = 1 Basic Mathematical functions • Rounds a number to nearest decimal you specify • Syntax of Round formula: round(this number, to this many digits after decimal)
Examples of Excel Round formula:
round(1.2365,0) = 1 round(1.2365,2) = 1.24 Basic Mathematical functions • Gives you a random number to play with • Syntax of Rand formula: rand()
Examples of Excel Rand formula:
rand() = who knows BASIC EXCEL UTILITIES Autofill • Autofill handle • Filling same number • Filling a series • Filling a series with even numbers • Autofill of date – check out options • Autofill mon-tue-wed, jan-feb-mar, rank – 1st,2nd, 3rd Copy & Paste in Excel • Simple Excel Copy and Paste • Select an Excel cell, or range of cells. • Copy the cell(s) by either: • Right clicking with the mouse and selecting 'Copy' from this menu; • Selecting 'Copy' from the home tab (or the Edit menu in older versions of Excel); • Using the keyboard shortcut, CTRL-C (i.e. select the CTRL key and while holding this down, press C). • Click on the location where you want to paste the copied cell(s). • Paste the copied cell(s) by either: • Right clicking with the mouse and selecting 'Paste' from this menu; • Selecting 'Paste' from the home tab (or the Edit menu in older versions of Excel); • Using the keyboard shortcut, CTRL-V (i.e. select the CTRL key and while holding this down, press V). Paste Special • Normally in Excel copy and paste, all information from the copied cells is pasted into the new cells. This includes any formulas or other cell contents, and the cell formatting. • To paste only one part of the original copied cells, (for example, you might want to paste the values but not the formatting) into the new range.
• Copying a work sheet
Further… • View gridlines • Fill colours • Change the text colour • Show All Formulas in a Spreadsheet – Control ` • Show formulas instead of the calculation • Example : `=today() Cell referencing • Relative References • By default, Excel cell references are relative references. This means that a simple cell reference, used within an Excel cell, will be adjusted when copied to other cells. • Take example of A1, B1, c1 = sum(a1:b1). Copy to next rows • when copied from row 1, into the rows 2 and 3, the reference to cell C1 adjusts to reference cells in rows 2 and 3. Cell Referencing • Absolute References • There are occasions when we need Excel cell references to remain constant when copied to other cells. In this case, we can use the $ symbol before a column or row reference, to make a cell reference absolute. • Example : use the absolute cell reference, $E$1. • When the reference =$E$1 is copied to cells A1-C3, the reference remains constant Cell Referencing • Absolute and relative referencing can be mixed. For example in the spreadsheet below, the reference =$A1 uses absolute referencing for the column and relative referencing for the row. Excel date and time • Adding and Subtracting Dates and Times in Excel • Examples : • Calculate the Number of Days Between Two Dates : A2-A1 • Calculate the Difference Between Two Times • Note that, in order to display this result, cell B1 should be formatted to have the time format "hh:mm"). • Calculate the Difference Between Two Dates and Times • Add a Time to a Date and Time • Common problem • Formatting Dates and Times in Excel • The results in of the above Excel date and time formulas may not show correctly • The cells can be made to show the correct result by formatting into a 'General', 'Date', 'Time', or 'Date & Time' format, depending on the required result type. Data management • Sorting • Filtering • Various Numerical Conditions (Equals, Does Not Equal, Greater Than, etc) - if you select one of these options, Excel will open up a box in which you can specify up to two simple numerical conditions; • (Top 10...) - Display rows containing the top N values; • (Above Average) - Display numerical values that are above the average value; • (Below Average) - Display numerical values that are below the average value; • (Custom Filter...) - This opens up the same box as you get when selecting the individual Numerical Conditions (Equals, Does Not Equal, etc), to allow you to specify up to two numerical conditions. Filtering • For filtering to work correctly, worksheet should include a header row to identify the name of each column. • Example • Select the Data tab, then click the Filter command. • Click the drop-down arrow for the column you want to filter. For example, filter column B to view only certain types of equipment. • The Filter menu will appear. • Uncheck the box next to Select All to quickly deselect all data. • Can apply multiple filters to help narrow down results • Check or uncheck the boxes depending on the data you want to filter, then click OK. In our example, we'll uncheck everything except for August. • Clearing filters applied Excel Functions • Excel COUNT & COUNTA Functions • The Excel Count and the Excel Counta functions both count the number of values within a supplied set of values or range of cells. • The two functions differ in the following ways: • The Count function returns the count of numeric values (includes numbers and dates); • The Counta function returns the count of all non-blank values (includes numbers, dates, text values, logical values and errors). Count functions • Values counted • Numbers and dates are always counted as numeric values by the Excel Count function. • Text representations and logical values are counted differently, depending on whether they are supplied as a value in a range of cells, or if they are supplied directly to the function. • Countblank • Counta • Count Countif • COUNTIF( range, criteria ) • range-The range of cells that should be tested against the supplied criteria and counted if the criteria is satisfied. criteria-A user-defined condition that is tested against each of the cells in the supplied range. • Examples IF THEN ELSE • The Excel IF function tests a user-defined condition and returns one result if the condition is true, and another result if the condition is false. • The syntax of the function is : • IF( logical_test, value_if_true, value_if_false ) Countif & Sumif • Countif • customers in given cities based on customer and city data • Checking on a range and counting • Pattern matching – example – no. of customers having ‘Powai’ in address eg. countif(C1:C100, "*POWAI*") • Counting positive numbers in a range eg countif(C1:C100,”>0”) • Sumif • sumif(in this range, values meeting this criteria, [sum-this-range])
sumif(A1:A20, 3) = sums the cells with a value of "3"
sumif(A1:A20, 3, b1:b20) = same as above but adds values in B1:B20 VLOOKUP • VLOOKUP( lookup_value, table_array, col_index_num, [range_lookup] ) • lookup_value-The value that you want to look up. • table_array-The data array or table, containing the search values in the left hand columns and the values to return in another column. • col_index_num-The column number, within the supplied table_array, that you want to return a value from. • The [range_lookup] can be set to TRUE or FALSE, meaning: • TRUE-If the function cannot find an exact match to the supplied lookup_value, it should use the closest match below the supplied value. • Note: if this option is used, the left-hand column of the table_array must be in ascending order. • FALSE-If the function cannot find an exact match to the supplied lookup_value, it should return an error. HLOOKUP • HLOOKUP( lookup_value, table_array, row_index_num, [range_lookup] ) • lookup_value-The value that you want to look for, in the first row of the supplied data array • table_array-The data array or table, containing the data to be searched and the return values. • row_index_num-The row number, within the supplied array, that you want the corresponding value to be returned from • [range_lookup]-An optional logical argument, which can be set to TRUE or FALSE, meaning: • TRUE-if the function cannot find an exact match to the supplied lookup_value, it should use the closest match below the supplied value. • Note: If [range_lookup] is set to TRUE, the top row of the table_array must be in ascending order). • FALSE-if the function cannot find an exact match to the supplied lookup_value, it should return an error Example Duplicates • Find duplicates using concatenate and conditional formatting • Remove duplicates using the ribbon Statistical functions • Standard Deviation • Variance • AVERAGE • PERCENTILE String functions • Excel Left, Mid and Right Functions • The Excel Left function returns a specified number of characters from the left (the beginning) of a supplied text string. • In the example below, the Left function returns the first two characters of the string "test string": • =LEFT( "test string", 2 ) returns the text string "te" • The Excel Mid function returns a specified number of characters from the middle of a supplied text string, beginning at a specified character. • In the example below, the Mid function returns 3 characters from the middle of the string "test string", starting from character number 6: • =MID( "test string", 6, 3 ) returns the text string "str". String functions • The Excel Right function returns a specified number of characters from the right (the end) of a supplied text string. • In the example below, the Right function returns the last two characters of the string "test string": • =RIGHT( "test string", 2 ) returns the text string "ng" String functions • The syntax of the Find function is: • FIND( find_text, within_text, [start_num] ) String functions • Split String at a Specific Character - Examples • Example 1 - Return Text From the Beginning of a Text String, Up to the First Space • If you want to use a formula to split a text string at the first space, and then return the left part of the split string, this can be done by combining the Left function with the Find function. This is shown in the example below:
• Test string = LEFT(A1,FIND(“ “,A1) -1)
• In the above formula, the Find function returns the value 5 as the position of the space within the supplied text "test string". Subtracting 1 from this value gives the value 4, which is then supplied to the Left function. String functions • Example 2 - Return Text From the End of a Text String • If you want to use a formula to split a text string at the first space, and then return the right (the end) part of the string, this can be done by combining the Right function with the Excel Find function and the Excel Len function. This is shown in the example below: • Test string =RIGHT(A1,LEN(A1)-FIND(“ “)) • In the above formula, the Len function returns the value 11, as the length of the string "test string" and the Find function returns the value 5 as the position of the space. • Therefore, the expression LEN( A1 ) - FIND( " ", A1 ) evaluates to 6 (= 11 - 5), which is then supplied to the Right function. • Therefore, the Right function returns the last 6 characters of the supplied string. String functions • SUBSTITUTE( text, old_text, new_text, [instance_num] )
The original text string containing the
text - text to be replaced. The sub-string that is to be found and old_text - replaced by new_text. The new text string that is to be used new_text - to replace the old_text.
An optional argument which specifies
which occurrence of old_text should be replaced by the new_text. •If a value of [instance_num] is [instance_num] - specified, just that instance of the old_text is replaced; •Otherwise, all instances of old_text are replaced with the new_text. Financial formulas • IRR – Internal rate of return • NPV – Net Present Value • Yield Future value Future value of an investment of $1,000 per month over 5 years, with a present value of $0, and an interest rate of 5% per year (payment made at end of each mth):
=FV( 5%/12, 60, -1000 )
We can add arguments at the end for
1. present value if any 2. 0 – end of payment period, 1 – beginning of payment period • Sort – discuss examples • Filter • Conditional formatting • Tables You can find the Solver on the Data tab • What are the decisions to be made? For this problem, we need Excel to find out how much to order of each product (bicycles, mopeds and child seats). • What are the constraints on these decisions? The constrains here are that the amount of capital and storage used by the products cannot exceed the limited amount of capital and storage (resources) available. For example, each bicycle uses 300 units of capital and 0.5 unit of storage. • What is the overall measure of performance for these decisions? The overall measure of performance is the total profit of the three products, so the objective is to maximize this quantity. • name the following ranges.
Range Name Cells
Unit_Profit C4:e4 Order_Size C12:e12 Resources_Used G7:G8 Resources_Available I7:I8 Total Profit I12 Put in sumproduct • Trial and Error • With this formulation, it becomes easy to analyze any trial solution. • For example, if we order 20 bicycles, 40 mopeds and 100 child seats, the total amount of resources used does not exceed the amount of resources available. This solution has a total profit of 19000. • Try out optimal solution using solver Optimal solution Transportation problem Transportation Problem • To formulate this transportation problem, answer the following three questions. • a. What are the decisions to be made? For this problem, we need Excel to find out how many units to ship from each factory to each customer. • b. What are the constraints on these decisions? Each factory has a fixed supply and each customer has a fixed demand. • c. What is the overall measure of performance for these decisions? The overall measure of performance is the total cost of the shipments, so the objective is to minimize this quantity. Solver example - Transportation To make the model easier to understand, name the following ranges.
Range Name Cells
UnitCost C4:E6 Shipments C10:E12 TotalIn C14:E14 Demand C16:E16 G10:G1 TotalOut 2 Supply I10:I12 TotalCost I16 Transportation problem Transportation Problem – trial Transportation Problem - solver • You have the choice of typing the range names or clicking on the cells in the spreadsheet. • 2. Enter TotalCost for the Objective. • 3. Click Min. • 4. Enter Shipments for the Changing Variable Cells. • 5. Click Add to enter the following constraint. Transportation problem
Conclusion: it is optimal to ship 100 units from Factory 1 to Customer 2,
100 units from Factory 2 to Customer 2, 100 units from Factory 2 to Customer 3, 200 units from Factory 3 to Customer 1 and 100 units from Factory 3 to Customer 3. This solution gives the minimum cost of 26000. All constraints are satisfied.