Upcoming SlideShare
×

# E-Book 25 Tips and Tricks MS Excel Functions & Formulaes

21,671 views

Published on

25 Tips & Tricks on Excel Functions and Formulas e-Book

48 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• --&gt; #InterrestinG :))

Are you sure you want to  Yes  No
• I SERACH FOR VLOOK UP FUNCTIONS IT 'S VERY USEFUL TO ME

Are you sure you want to  Yes  No
• Thanks you very much :)

Are you sure you want to  Yes  No
Views
Total views
21,671
On SlideShare
0
From Embeds
0
Number of Embeds
143
Actions
Shares
0
5,167
3
Likes
48
Embeds 0
No embeds

No notes for slide

### E-Book 25 Tips and Tricks MS Excel Functions & Formulaes

1. 1. Table of Contents Tip 1: Calculating the Number of Months Service for an Employee 3 Tip 2: Using Custom Format 4 Tip 3: Formula Auditing – Showing Cell Dependencies 5 Tip 4: Finding the Cell with the Highest Value in a Range 6 Tip 5: Combining Text From Multiple Cells into One 9 Tip 6: Use MATCH and INDEX as an Alternative to The Vertical Lookup 10 Tip 7: Adding Criteria/Conditions to Your Sum Function 13 Tip 8: Sumif Between Workbooks 15 Tip 9: Positive and Negative Numbers 18 Tip 10: Formula to Find Duplicate Values in a Data Range 20 Tip 11: Generating of Random Numbers for Testing of Formulas 21 Tip 12: Convert Function 23 Tip 13: Calculating the Periodic Payment for a Loan 27 Tip 14: Using the PMT Function to Reach a Target 31 Tip 15: The SUMIF Function 35 Tip 16: The SumIF Function 37 Tip 17: Making Forecasts with the Forecast Function 39 Tip 18: IF Function 42 Tip 19: Evaluating Multiple Conditions in a Formula with the Nested IF Statement 44 Tip 20: Using the AND Function to Perform Numerous Logical Tests 46 Tip 21: Trapping Error Messages By Using The IF Error Function 48 Tip 22: Aggregate Function 50 Tip 23: TRIM Function 53 Tip 24: Vlookup Approximate Value 55 Tip 25: Distinct Count 57
2. 2. 32013TipsTricksEbook|FunctionsFormulae Tip 1: Calculating the Number of Months Service for an Employee By using the DATEDIF function one is able to calculate the number of month’s service for an employee. Below we explain how: Applies To: MS Excel 2003, 2007 and 2010 Use the “DATEDIF” function 1. The date employed is in cell A3 and the current date is in cell B3. 2. Select cell C2 and enter = (DATEDIF(A2,B2,”Y”)*12)+DATEDIF(A2,B2,”YM”). 3. Format to number.
3. 3. 42013TipsTricksEbook|FunctionsFormulae How to format a number without decimal places, with a thousands separa- tor, and combine it with text, using custom formatting and joining cells. Applies To: MS Excel 2003, 2007 and 2010 1. For example, Cell A1 contains “You owe” and cell B1 contains the value 87777. In cell C1 enter the following formula =A1” “TEXT(B1,”\$#,##0”). Tip 2: Using Custom Format
4. 4. 52013TipsTricksEbook|FunctionsFormulae Some spreadsheets can get very complicated, with many cells relying on other cell calculations to deliver information and a change of one cell can have dramatic effects. Formula Auditing will show you which cells are connected. Applies To: MS Excel 2003, 2007 and 2010 1. To trace all preceding cells: a. Select the desired cell. b. From the Formulas tab, in the Formula Auditing group, select Trace Precedents. c. If the Precedent cells are found on another worksheet, you will get a dotted line. d. Double click on the dotted line, select the reference, select OK. 2. To trace all dependant cells: a. Select the desired cell. b. From the Formulas tab, in the Formula Auditing group, select Trace Dependents. 3. To remove all the arrows: a. Select the desired cell. b. From the Formulas tab, in the Formula Auditing group, select Remove Arrows. Tip 3: Formula Auditing – Showing Cell Dependencies
5. 5. 62013TipsTricksEbook|FunctionsFormulae At times you may be working with data where you need to find the maxi- mum value. To do this, you can sort or use the MAX function. You may however, might not want to sort the column and are looking for the MAX value, but would like to know the cell address that contains the maxi- mum value. Example: MATCH: MATCH (lookup_value,lookup_array,match_type) The MATCH function will return the row number of the highest value. Lookup_value: Is the value you use to find the value you want in a table. Lookup_value can be a value (number, text, or logical value) or a cell reference to a number, text, or logical value. Lookup_array: Is a contiguous range of cells containing possible lookup values. Match_type: Is the number -1, 0, or 1. Match_type specifies how Microsoft Excel matches lookup_value with values in lookup_array. If match_type is 0, MATCH finds the first value that is exactly equal to lookup_value. Lookup_array can be in any order. Tip 4: Finding the Cell with the Highest Value in a Range
6. 6. 72013TipsTricksEbook|FunctionsFormulae ADDRESS: ADDRESS (row_num,column_num,abs_num,a1,sheet_text) The ADDRESS function will return the cell address of the highest value. Row_num: Is the row number to use in the cell reference. Column_num: Is the column number to use in the cell reference. Abs_num: Specifies the type of reference to return. 1- Absolute, 2- Absolute row; relative column, 3- Relative row; absolute column, 4- Relative MAX: MAX (number1,number2,...) Number1, number2: Are 1 to 255 numbers for which you want to find the maximum value. Applies To: MS Excel 2003, 2007 and 2010 1. Open Microsoft Excel®. 2. Select the desired result cell. 3. Select the Insert Function button on the Formula bar. 4. In the Row_num box, enter in the below: 5. MATCH(MAX (“Column to calculate max”),”Column to find the max, finds the first value that is exactly equal). 6. In the Column_num box, enter the below. 7. You want to use column D (4) as the result reference. 8. In the Abs_num box, enter the below. 9. You would like a relative reference. 10. Select OK.
7. 7. 82013TipsTricksEbook|FunctionsFormulae
8. 8. 92013TipsTricksEbook|FunctionsFormulae Let’s say you have imported Main Account and Sub Account numbers into separate columns you can actually combine the two to have the New Account. All this can be done by way of a simple formula. Using the (ampersand) sign is the same as using the Concatenate function, but much simpler. Below is an example in column C, of where the Main Account and Sub Account numbers need to be joined into one cell with a /(forward slash) to separate the Accounts. Applies To: MS Excel 2003, 2007 and 2010 1. Select the desired cell (C2). 2. Enter =. 3. Select the first cell to join (A2). 4. Enter in . 5. If necessary, add any additional data that my not be found in a cell (“/”). 6. Enter in . 7. Select any additional cells to join (B2). 8. Press Enter. Tip 5: Combining Text From Multiple Cells into One
9. 9. 102013TipsTricksEbook|FunctionsFormulae Vertical Lookup is one of the commonly used MS Excel functions. But it has limitations in that the main search criterion needs to be in the first column. However by using a combination of MATCH and INDEX, you can return values from an array regardless of what information is in the first column of the array. Follow our example below as we explain how you can use MATCH and INDEX as an alternative to the Vertical Lookup. MATCH: Returns the relative position of an item in an array that matches a specified value in a specified order. INDEX: Returns a value or reference of the cell at the intersection of a particular row and column, in a given range. Applies To: Excel 2003, 2007 and 2010 1. Reference will be made to the screen shot below. We are going to retrieve the Commission Rate for P7. 2. Select cell G5. 3. Select as below. Tip 6: Use MATCH and INDEX as an Alternative to The Vertical Lookup
10. 10. 112013TipsTricksEbook|FunctionsFormulae 4. Select as below. • In the first option the data array is only based on one data range • In the second option the data array is based on multiple data ranges 5. Enter as below.
11. 11. 122013TipsTricksEbook|FunctionsFormulae 6. Select OK. 7. The answer will be 22% as given below.
12. 12. 132013TipsTricksEbook|FunctionsFormulae By using the DSUM function, you can specify criteria and conditions regarding which cells should be added together. An alternative to using DSUM is using SUMIF, but SUMIF is not suitable for complex criteria. The list below shows monthly and daily product sales. In cell G5 we have calculated a running total using the DSUM function, which takes into ac- count a number of criteria that has been set up in the range A1:D2 We will use the DSUM function to calculate the total sales that meets the following criteria: Monthly sales for February that are greater than \$500 and where the weekday is Tuesday and the product is Ipoh Coffee. Example: The syntax for the DSUM function is : = DSUM (database, field, criteria) The arguments of the DSUM function are explained below. Database: Is the range of cells that makes up the list or database. A database is a list of re- lated data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column. Tip 7: Adding Criteria/Conditions to Your Sum Function
13. 13. 142013TipsTricksEbook|FunctionsFormulae Field: Indicates which column is used in the function. Field can be given as text with the column label enclosed between double quotation marks, such as “Age” or “Yield,” or as a number that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on. Criteria: Is the range of cells that contains the conditions you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label for specifying a condition for the column. Applies To: MS Excel 2003,2007,2010 and 2013 1. Select the cell G5. 2. Enter the formula below: =DSUM (A5:D19,4,A1:D2) (A5:D19) is the database, (4) is the field number for sales, (A1:D2) is the criteria range. 3. Press Enter. 4. The answer will be \$2,400.00.
14. 14. 152013TipsTricksEbook|FunctionsFormulae When using the SUMIF function between workbooks, you may get a VALUE error if the source workbook is not open. To work around this, use a combination of the SUM and IF functions together in an array formula. Example The source workbook, filename Data: The workbook with the formula: Tip 8: Sumif Between Workbooks
15. 15. 162013TipsTricksEbook|FunctionsFormulae This behaviour occurs when the formula that contains the SUMIF, COUNTIF, or COUNTBLANK function refers to cells in a closed workbook. If you open the referenced workbook, the formula works correctly. • Instead of using a formula that is similar to the following =SUMIF([Source]Sheet1!\$A\$1:\$A\$8,”a”,[Source]Sheet1!\$B\$1:\$B\$8) • use the following formula: =SUM(IF([Source]Sheet1!\$A\$1:\$A\$8=”a”,[Source]Sheet1!\$B\$1:\$B\$8,0)) An array formula is a formula that can perform multiple calculations on one or more of the items in an array. Array formulas act on two or more sets of values known as array arguments. • Each argument within an array must have the same amount of rows and columns • You must enter an array by pushing Ctrl + Shift + Enter • You cannot add the {} (braces) that surround an array yourself, pushing Ctrl + Shift + Enter will do this for you. SUMIF: SUMIF(range,criteria,sum_range) Range : Is the range of cells that you want evaluated by criteria. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored. Criteria : Is the criteria in the form of a number, expression, or text that defines which cells will be added. Forexample, criteria can be expressed as 32, “32”, “32”, or “apples”. Sum_range : Are the actual cells to add if their corresponding cells in range match criteria. If sum_range is omitted, the cells in range are both evaluated by criteria and added if they match criteria.
16. 16. 172013TipsTricksEbook|FunctionsFormulae Applies To: MS Excel 2003, 2007 and 2010 1. Open the workbook that contains the source (Data). 2. Open the workbook that will contain the formulae. 3. Select the desired cell in the workbook that will contain the formulae (B2). 4. Using the FX button on the Formula Bar, locate the Sum Function. 5. To nest in the IF Function, from the Formula bar, in the Name Box, from the drop down arrow, select IF. If the IF function does not appear, select More Functions and locate the IF Function. 6. Enter in the arguments in the Logical Test. Logical_test – If cells A3:A12 in the Data workbook on Sheet 1 = East Value_if_true – If the above is true, sum the range B3:B12 Value_if_false – IF the above is not true, place 0. 7. Press Ctrl + Shift + Enter.
17. 17. 182013TipsTricksEbook|FunctionsFormulae Have you ever had a column with positive and negative numbers, but would like to sum the positive and negative numbers separately? This can be done by using the SUMIF function. Example: SUMIF SUMIF(range,criteria,sum_range) Range: Is the range of cells that you want evaluated by criteria. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored. Criteria: Is the criteria in the form of a number, expression, or text that defines which cells will be added. For example, criteria can be expressed as 32, “32”, “32”, or “apples”. Sum_range : Are the actual cells to add if their corresponding cells in range match criteria. If sum_range is omitted, the cells in range are both evaluated by criteria and added if they match criteria. Applies To: MS Excel 2003, 2007 and 2010 1. To add the positive numbers as per the example: a. Select the desired cell (E13) b. Enter in the below formula: =SUMIF(E4:E12,”0”) c. Press Enter. 2. To add the negative numbers: a. Select the desired cell (E14) b. Enter in the below formula: =SUMIF(E4:E12,”0”) c. Press Enter. Tip 9: Positive and Negative Numbers
18. 18. 192013TipsTricksEbook|FunctionsFormulae
19. 19. 202013TipsTricksEbook|FunctionsFormulae Are you tired of manually sorting and checking each cell in order to find duplicates? Well by using the COUNTIF function you can find dupli- cates in a data range. Applies To: MS Excel 2003, 2007 and 2010 Here is how you can do it: =COUNTIF(\$A:\$A,\$A3)1 =COUNTIF(column with duplicates, first cell in column)1 The CountIF will return a Yes or a No to a question: the question in this instance is whether the number of times the value in cell A3 is counted is greater than 1. If it is, then it’ll return Yes, otherwise False. Tip 10: Formula to Find Duplicate Values in a Data Range
20. 20. 212013TipsTricksEbook|FunctionsFormulae The RANDBETWEEN function can be used to create some random num- bers for testing of formulas. Implying that there is no need of cracking up one’s head to generate the random numbers. Applies To: MS Excel 2003, 2007 and 2010 The RANDBETWEEN function allows you to generate a random whole number inside of a range. The syntax is: =RANDBETWEEN(bottom,top) The bottom parameter is the lowest number in the range you want to use, and top is the highest number in the range. 1. Select cell A2 and type =RANDBETWEEN(1,100) and press Enter. When you press Enter, a random whole number between 1 and 100 is generated (in this instance, the number 32 is returned). 2. Move your mouse to the bottom left hand corner of cell A2, click and hold on the AutoFill Handle, and drag it down to cell A7. Tip 11: Generating of Random Numbers for Testing of Formulas
21. 21. 222013TipsTricksEbook|FunctionsFormulae You’ll note that the moment you release the AutoFill Handle, all cells generated a random number, including cell A2 – it has changed from 32 to 78. RANDBETWEEN will generate a new number each time you press Enter, or even when you use the UNDO or REDO functions (as long as you’re not altering any of the RANDBETWEEN cells). 3. Select cell B2. Type in =A2*100 and press Enter. Again, when you hit Enter, you’ll notice that all values in cells A2 to A7 change to a new, random value.
22. 22. 232013TipsTricksEbook|FunctionsFormulae The Convert function can be used to ensure that all values are in one standard unit. If you have people entering travel distances onto a spread sheet, but some put in miles values and others kilometre values. The Convert function can be used to ensure that all values are in kilo- metres. Applies To: MS Excel 2003, 2007 and 2010 Firstly, an advisement: you will never cover every possible way that someone might enter the value “20 km”. It could be entered as “20 kilos”, “20km”, “20 km”, “20 kilometres” and every possible spelling mistake of those. The best option in this instance would be to have the number entered in one column, say, Column A, and then using a Data Validation list in Column B to select either “mi” or “km”, limiting how users enter the information and giving you something to work with (hoping they don’t type in “twenty” instead of “20”). If you do manage to have people entering in information inconsistently e.g. “20 mi” or “20 km”, here’s how you could do it. We’re going to use a table with six sample distances: 1. Select cell B1. Type in =RIGHT(A1,2) and press Enter. This will tell you if the value in cell A1 is in miles or kilometres. Tip 12: Convert Function
23. 23. 242013TipsTricksEbook|FunctionsFormulae 2. Select cell C1. Type in =LEFT(A1,LEN(A1)-3) and press Enter. The LEN() function returns the length of cell A1. By subtracting 3 from this amount (i.e. the letters and the space), you are left with the total number of characters for the value. This will mean you’ll capture all numbers, regardless of how big and how many decimal places there may be. 3. Select cell D1. Type in =CONVERT(C1,”mi”,”km”) and press Enter.
24. 24. 252013TipsTricksEbook|FunctionsFormulae The CONVERT function changes the value from a miles value to a kilometres value – the first option after the target cell (C1) is the value to convert from, the second is the value to convert to. There are other conversion options that include weight and mass, distances, liquid measures and temperatures. Search in Excel Help for the CONVERT function to see a full list. 4. Select cell E1. Type in =IF(B1=”mi”,D1,C1) and press Enter. The formula will check to see whether this is a “mi” value and if so, return the kilometre value in D1, otherwise it will pull the original value from C1. 5. Highlight cells B1:E1. 6. Use the AutoFill Handle and drag down to cell E6.
25. 25. 262013TipsTricksEbook|FunctionsFormulae This will fill all of the formulas down to row 6. For those who like to conserve space, the above could be accomplished in one, nested formula: =IF(RIGHT(A1,2)=”mi”,CONVERT(LEFT(A1,LEN(A1)-3),”mi”,”km”),LEFT(A1,L EN(A1)-3)) NB: to use the CONVERT function in Excel 2003, you will need to have the Analysis ToolPak installed. This can be done by using the MS Office installation CD, customising the MS Excel installation option and ticking the box for the Analysis ToolPak. The function comes standard with Excel 2007.
26. 26. 272013TipsTricksEbook|FunctionsFormulae If you are looking at taking out a loan from the bank and know how your loan is and what the interest rate would be. The PMT function can be used to figure out what the payment would be per month. Applies To: MS Excel 2003, 2007 and 2010 When it comes to finance, personal or business, knowing what you’re pay- ing or how much you’re spending is paramount. Knowing how you can save money by adjusting your payments is a very handy thing, and you can use the PMT function to not only work this out, but also to see what you would have to pay before you enter into a loan agreement. The PMT function has the following syntax: =PMT(rate,nper,pv,[fv],[type]) Rate: this is the interest rate to be paid per period. Nper: this is the number of periods in the life of the loan (i.e. the number of payments to be made). Pv: the present value of the loan amount. [Fv]: the future value (optional). [Type]: shows whether payment is to be made on the first day or the last day of the month. In this example, we will use the following information to see how much we would need to pay back in monthly instalments on a \$100,000 loan over seven years. Tip 13: Calculating the Periodic Payment for a Loan
27. 27. 282013TipsTricksEbook|FunctionsFormulae 1. Select cell B9, type in =C5/12 and press Enter. In order to work out the amount per period, we need to divide the yearly interest rate (12%) by the number of periods in the year. In this case, we’re making payments on a monthly basis, hence dividing the rate by 12. 2. Select cell C9, type in =C4*12 and press Enter. The loan is over 7 years, with payments made monthly. Therefore we need to work out the total number of periods, hence multiplying the loan years by 12. 3. Select cell D9, type in =C3 and press Enter.
28. 28. 292013TipsTricksEbook|FunctionsFormulae We could directly reference cell C3 when we create our formula, but for consistency in the example layout we will reference it to our demonstration line. 4. Select cell E9, type =pmt(B9,C9,D9) and press Enter. The formula references the interest rate for the period (rate = B9), the number of periods (nper = C9) and the present value of the loan (pv = D9). As [fv] and [type] are in square brackets, they’re optional values and don’t need to be entered. When you press enter, you will see the monthly amount to be repaid: The amount is represented as a negative figure because this is money that you will be paying. If you would like to see it as a positive number, simply multiply the result by -1.
29. 29. 302013TipsTricksEbook|FunctionsFormulae 5. Select cell F9, type in =E9*C9 and press Enter. You can now see how much will be repaid over the life of the loan. However, you can start playing with the numbers to see what effect it will have on the overall amount. 6. Select cell C4 (the loan years amount), type in 5 and press Enter. Changing the number of years to 5 changes the number of total periods from 84 to 60 (seen in cell C9). This means an increase in the monthly payment amount from \$1,765.27, however it decreases the total amount repaid from \$148,282.96 to \$133,466.69.
30. 30. 312013TipsTricksEbook|FunctionsFormulae Are you planning on going on holiday and would like to save, say \$10,000 to cover all expenses. By utilising the PMT function you can actually figure out how much you need to pay into your savings each month to reach the target. Applies To: MS Excel 2003, 2007 and 2010 When it comes to finance, personal or business, knowing what you’re paying or how much you’re spending is paramount. Knowing how you can save money by adjusting your payments is a very handy thing, and we can use the PMT function to not only work this out, but see what we would have to pay before we enter into a loan agreement. The PMT function has the following syntax: =PMT(rate,nper,pv,[fv],[type]) Rate: this is the interest rate to be paid per period. Nper: this is the number of periods in the life of the loan (i.e. the number of payments to be made). Pv: the present value of the loan amount. [Fv]: the future value (optional). [Type]: shows whether payment is to be made on the first day or the last day of the month. In this example, we’re going planning to go on an overseas holiday in three years time. In order to do this, we’ll need to save \$10,000 to cover costs of flights, accommodation etc. So how much will I need to pay into my savings account, at a set interest rate, each month for three years to get to my target? Tip 14: Using the PMT Function to Reach a Target
31. 31. 322013TipsTricksEbook|FunctionsFormulae 1. Select cell B10, type in =C5/12 and press Enter. In order to work out the amount per period, we need to divide the yearly interest rate (12%) by the number of periods in the year. In this case, we’re making deposits on a monthly basis, hence dividing the rate by 12. 2. Select cell C10, type in =C4*12 and press Enter. The savings plan is over 3 years, with payments made monthly. Therefore we need to work out the total number of periods, hence multiplying the loan years by 12. 3. Select cell D10, type in 0 and press Enter.
32. 32. 332013TipsTricksEbook|FunctionsFormulae There isn’t a present value amount – we have no savings to start with. Hence, PV = 0. 4. Select cell E10, type =pmt(B9,C9,D9,C3) and press Enter. The formula references the interest rate for the period (rate = B10), the number of periods (nper = C9) and the present value of the loan (pv = 0). Since we’re trying to determine payments against a future amount, we can now use the [fv] option – choose the future value we’d like to work to (in this case, cell C3).
33. 33. 342013TipsTricksEbook|FunctionsFormulae The amount is represented as a negative figure because this is money that you will be paying out. If you would like to see it as a positive number, simply multiply the result by -1. However, what if we actually began our savings plan with \$2,500 in the bank? 5. Select cell C6 (the currently saved field), type in -2500 and press Enter. The currently saved amount needs to be entered as a negative: this money is being paid out by you into your savings fund, so it’s a negative amount. 6. Select cell D9, type in =C6 and press Enter. By including the currently saved amount (i.e. the present value), you have now added extra money to your plan, and significantly affected your repayments for the better.
34. 34. 352013TipsTricksEbook|FunctionsFormulae The SUMIF function is very useful, allowing you to total a number of lines together based on one common trait. This could be a product name, a region or category, or a particular person’s name. Applies To: MS Excel 2003, 2007 and 2010 The syntax of the SUMIF function is as follows: =SUMIF(range,criteria,[sum_range]) In the syntax, the range is the column that you’d like to search through for a given value (the criteria), and when it finds it, add the appropriate value from the [sum_range] column. This is based on the row that the criteria is in – if the term, chocolate biscuits” is in column A, rows 6, 9 and 12, with the product sale values listed in column C, then the SUMIF formula: =SUMIF(A:A,”chocolate biscuits”,C:C) would add cells C6, C9 and C12 together. In this example, we’re going to use the following table of information. Column H has a unique list of all sales people in column A, and we will use the SUMIF function to add the total product sales together for each sales person. 1. Select cell I2, type in the formula =SUMIF(A:A,H2,F:F) and press Enter. Tip 15: The SUMIF Function
35. 35. 362013TipsTricksEbook|FunctionsFormulae This will search through column A for all references of the content of cell H2 (in this instance “Anderson P”), and then add the appropriate value in the cell in column F for that row. 2. Double click on the Auto-Fill handle in the bottom left hand corner of cell I2. This will automatically fill the formula down to cell H14. By referencing cell H2, the formula will increment automatically, meaning that we don’t have to type in each and every value – they can be typed into each of the H cells, or changed in those cells much more easily than editing the formula.
36. 36. 372013TipsTricksEbook|FunctionsFormulae Assuming you have a sheet of sales information and would like to add together all lines for not only a specific product category, but for all sales of that product category on a particular region. You can actually use the SUMIFS function to accomplish that. Applies To: MS Excel 2007 and 2010 The SUMIF function allows you to total a number of lines together based on one common trait, such as a product name, a region or category, or a particular person’s name. However, the SUMIFS function looks at the situation where you may want to add values together based on two or more criteria, such as product name as well as a particular region. The syntax of the SUMIFS function is as follows: =SUMIFS(sum_range,criteria_range1,criteria1,…) In the syntax, the sum_range is the column that contains the values you would like to add together. Criteria_range1 is the range that you would like to search in for your first criteria value (criteria1), and this can be repeated using the same syntax (i.e. criteria_range2, criteria2, criteria_rangeX,criteriaX, …). You can include up to 127 different range/criteria pairings. In this example, we’re going to use the following table of information. Column A contains all of the regions, with column C containing product categories. We will use the SUMIFS function to add the total product sales together (column G) for all beverage sales on the North Coast. We have highlighted the cells that will be added together in light green, to show which cells will be targeted. Tip 16: The SumIF Function
37. 37. 382013TipsTricksEbook|FunctionsFormulae 1. Select cell K2, type in the formula =SUMIFS(G:G,A:A,I2,C:C,J2) and press Enter. This will search through column A for all “North Coast” references. It will then check whether the Category Name cell in that row (column C) contains the “Beverages” reference. If the row contains “North Coast” and “Beverages”, then the Product Sales field for that row will be added to the total. You’ll note in the SUMIFS formula tip in the graphic that from criteria_range2 onwards, the parameters are in square brackets (e.g. [criteria_range2, crite- ria2]) - this means that the extra criteria past the first is optional. The SUMIFS function can be used then in place of SUMIF, which requires only one criteria, as everything from the second criteria onwards is not required. NB: The SUMIFS function is not available in MS Excel 2003.
38. 38. 392013TipsTricksEbook|FunctionsFormulae If you are recording monthly sales amounts and there seems to be a constant upward trend, though the increase each month isn’t the same amount. You can use the FORECAST function to know when a certain sales amount has been hit. Applies To: MS Excel 2007 and 2010 The FORECAST function can work whenever you have a set of data pairs: an x-value range (say, date) and a y-value range (say, value of sales for that date). The function uses a trend line on the y-value target amount (e.g. a sales amount target), then applies the same trend to the x-value range to work out the date that target will be reached. The values in the x-value range must be numbers, otherwise the function will return a #VALUE! Error. In this example, we’ll be using the following data table which lists sales dates from the end of the month, and the value of those sales for that month. We’ll use the FORECAST function to determine on which date sales will exceed \$2000. 1. Select cell E2. 2. Type in =FORECAST(D2,A2:A9,B2:B9) and press Enter. Tip 17: Making Forecasts with the Forecast Function
39. 39. 402013TipsTricksEbook|FunctionsFormulae 3. The formula returns a value of 40716.54041. 4. We can now format this number to return a date value. While cell E2 is still selected, press CTRL + 1. This will bring up the “Format Cells” window. On the “Number” tab, select the “Date” option in the left hand menu, then your desired date format on the right, the click OK.
40. 40. 412013TipsTricksEbook|FunctionsFormulae 5. The number will now be converted to a date and we can see that sales are estimated to exceed \$2000 on 22nd June, 2011.
41. 41. 422013TipsTricksEbook|FunctionsFormulae Ever tried to create a formula with a condition but could not. Perhaps you intend to have different answers depending on the status (true or false) of the condition. Then the answer to your problem is the IF func- tion. The IF function is one of Excel’s most useful and most used functions. What it does, basically, is test to see whether a certain condition is true or false. If the condition is true, the function will do one thing, if the condition is false, the function will do something else. Syntax: =IF(logic test, value if true, value if false) Applies To: MS Excel 2003 ,2007 and 2010 1. To calculate the commission figures for the following employees. Base on the following criteria. If the above target figure is above the target benchmark of \$10,000 then multiply the value by 20% if the above target figure is below \$10,000 then multiply the figure by 5%. 2. You can use the IF Statement. 3. Use the following formula and copy down =IF(B510000,B5*20%,B5*5%). 4. The commission figures will be automatically calculated based on the IF function. Tip 18: IF Function
42. 42. 432013TipsTricksEbook|FunctionsFormulae 5. The logic test is always a comparison between two values. Comparison operators are used, for example, to see if the first value is greater than or less than the second, or equal to it. 6. While the logic test section is limited to answering a true or false question, you have greater flexibility in what you place in the last two arguments. 7. The IF function can perform different calculations depending on whether the function returns a true value or not. Note: There is no comma separator used for the number in 10,000 in the above example. This is because the IF function uses the comma to separate the three sections of the IF function contained within the round brackets.
43. 43. 442013TipsTricksEbook|FunctionsFormulae Are you planning on evaluating multiple conditions in a formula? Like in the example below where a specific trade discount percentage will be used depending on the quantity purchased. If that is the case then you can use the Nested IF statement. The Nested IF statement enables one to evaluate multiple conditions in a formula. As a result more elaborate tests of data can be constructed. Applies To: MS Excel 2003 ,2007 and 2010 The IF statement can be used to conduct conditional tests on values and formulas. However if more elaborate testing of data will be carried out then the Nested IF Statement can be used. 1. To calculate the trade discount percentage for clients based on the table below; TOTAL PURCHASES DISCOUNT PERCENTAGE =\$30,000 7% =\$20,000 5% =\$10,000 3% \$10,000 0% 2. Enter the data given below. Tip 19: Evaluating Multiple Conditions in a Formula with the Nested IF Statement
44. 44. 452013TipsTricksEbook|FunctionsFormulae 3. Select cell D2 and type the following formula; =IF(C2=30000,”7%”,IF(C2= 20000,”5%”,IF(C2=10000,”3%”,”0%”))). 4. Press enter and copy the formula down. 5. The result will be as below.
45. 45. 462013TipsTricksEbook|FunctionsFormulae Expanding the usefulness of other functions that perform logical tests can be achieved with the AND function. One can actually test many dif- ferent conditions by nesting the And function with the IF statement. Applies To: MS Excel 2003 ,2007 and 2010 Returns TRUE if all its arguments evaluate to TRUE; returns FALSE if one or more arguments evaluate to FALSE. One common use for the AND function is to expand the usefulness of other functions that perform logical tests. 1. To qualify for a bonus an employee must exceed \$1000 in sales and have 3 or more years in service to the company. Furthermore they should also belong to the Sales Department. 2. If those initial conditions are met the deserving employees will get \$100 for each year served plus 5% of their total sales amounts. 3. Select cell F2 and type the following formula; =IF(AND(C21000,D2=3,E2=”sales”),(C2*5%)+ (D2*100),”No Bonus”). 4. Press enter and copy the formula down. 5.The result will be as given below. Tip 20: Using the AND function to perform numerous logical tests
46. 46. 472013TipsTricksEbook|FunctionsFormulae
47. 47. 482013TipsTricksEbook|FunctionsFormulae If you’ve worked with formulas, you’ve probably encountered the dreaded formula error. Rather than return a numeric result, the formula cell dis- plays a weird message such as #VALUE! or #DIV/0!. Most of the time, this means you need to track down the source of the error and fix it. But sometimes a formula error simply means that the data used by the formula is not yet available. For example, say you run a small telemarketing company. You might have a spreadsheet set up to track your daily sales as a percentage of calls made. Applies To: MS Excel 2003 ,2007 and 2010 Tip 21: Trapping Error Messages By Using The IF Error Function
48. 48. 492013TipsTricksEbook|FunctionsFormulae 1. The formulas in column D do the calculations that come up with the percentages. For example, cell D4 contains the formula =C4/B4.The answer was then converted to percentages by using the percent style option. 2. The formula does its job well--as long as there is data to calculate. An empty cell (such as B9) is treated as a zero, and division by zero is not allowed. As a result, Excel displays an ugly #DIV/0! error message, which makes your entire worksheet look like it was created by a novice. 3. You can avoid displaying formula errors by re-writing your formula to use an IFError function. For example: =IFERROR((C4/B4),””). 4. Displays a blank if the division operation results in an error (cell B4 is empty or contains 0), yet still displays valid results. 5. If you prefer, you can replace the empty string (“”) with other text of your choice--just make sure the text is enclosed in quote marks.
49. 49. 502013TipsTricksEbook|FunctionsFormulae Are you planning on finding the sum for a range of numbers with error values within the range? You can actually use the Aggregate Function to overcome the limitation posed by some functions like Sum, MAX, MIN, AVERAGE and Percentile functions. The Aggregate Function addresses the limitation of conditional formatting. Data bars, Icon Sets and Color Scales cannot display conditional formatting if there are errors in the range. This is because the MIN, MAX and PERCENTILE functions do not calculate when there is an error in the calculation range. The LARGE, SMALL, and STDEVP functions also affect the appropriate functionality of certain conditional formatting rules for the same reasons. By using the AGGREGATE Function, you can implement those functions because the errors will be ignored. In addition, the AGGREGATE Function can apply different aggregate functions to a list or database with the option to ignore hidden rows and error values. Syntax: AGGREGATE(function_num, options, ref1, [ref2], …) Applies To: Excel 2010 1. Refer to the data given below. 2. Select B11 and enter; =Sum(B5:B10) and press Enter. Tip 22: Aggregate Function
50. 50. 512013TipsTricksEbook|FunctionsFormulae 3. An error message will be displayed in the Total. Delete the error message in cell B11. 4. To overcome this limitation, we shall use the Aggregate function. 5. Select cell B11. 6. Select Formulas, Insert Function and search for the Aggregate function. 7. Select OK. 8. Select as below. 9. Enter as below.
51. 51. 522013TipsTricksEbook|FunctionsFormulae 10. Select OK. 11. The answer will be as below. The following numbers represent some function numbers than can be used in the formula above: 1=Average,2=Count,3=CountA,4=Max,5=Min,9=Sum For Option numbers refer to the table below. OPTION BEHAVIOUR 0 or omitted Ignore nested SUBTOTAL and AGGREGATE functions 1 Ignore hidden rows, nested SUBTOTAL and AGGREGATE functions 2 Ignore error values, nested SUBTOTAL and AGGREGATE functions 3 Ignore hidden rows, error values, nested SUBTOTAL and AGGREGATE functions 4 Ignore nothing 5 Ignore hidden rows 6 Ignore error values 7 Ignore hidden rows and error values
52. 52. 532013TipsTricksEbook|FunctionsFormulae The Trim Function can be used to clean up data. Let’s say you have imported data into Excel from another application with leading or trailing spaces. The Trim Function Removes all spaces from text except for single spaces between words. Use TRIM on text that you have received from another application that may have irregular spacing. Applies To: MS Excel 2003, 2007, 2010 1. For this example the screen shot given below will be used. 2. Select cell B2 and type =Trim(A2) then press enter. Drag the formula down. Tip 23: TRIM Function
53. 53. 542013TipsTricksEbook|FunctionsFormulae 3. The result will be as follows. As you can see from the data above, all spaces from the text except for single spaces between words have been removed.
54. 54. 552013TipsTricksEbook|FunctionsFormulae Ever used the Vlookup with the approximate match? In this example we demonstrate how, by using the Vlookup with the approximate match, one can extract the correct trade discount percentage based on the quantity purchased. If TRUE or 1 is specified in the Range_lookup argument text box, an exact or approximate match is returned. If an exact match is not found, the next largest value that is less than lookup_value is returned. (The Range_lookup argument text box can also be left blank). The values in the first column of table_array must be placed in ascending sort order; otherwise, VLOOKUP may not give the correct value. Applies To: MS Excel 2003,2007,2010 1. This tip will be based on the screen shot above. 2. Select cell D3. 3. Select the Formulas Tab-Lookup and Reference-Vlookup. Tip 24: Vlookup Approximate Value
55. 55. 562013TipsTricksEbook|FunctionsFormulae 4. Enter as below. 5. The original Table_array is G2:H8. Dollar signs have been added to the data range to make it absolute-hence we have \$G\$2:\$H\$8. 6. Select OK and copy the formula down. 7. To calculate the Total Sales: a. Select cell E3 and enter the formula: =(A3*C3)-(D3*(A3*C3)). b. Copy the formula down. 8. The final result will be as below.
56. 56. 572013TipsTricksEbook|FunctionsFormulae There is no function that calculates the distinct count for a range of values in MS Excel. However by using a combination of functions the Distinct Count can be calculated. In the example below by using a combination of the SUM, IF and, FREQUENCY functions we are going to calculate the total number of clients who have placed orders for various products. FUNCTION DETAILS The FREQUENCY function calculates how often values occur within a range of values, and then returns a vertical array of numbers. Because this function returns an array, it must be entered as an array formula. The IF function returns one value if a condition you specify evaluates to TRUE, and another value if that condition evaluates to FALSE. The SUM function adds all the numbers that you specify as arguments. Applies To: MS Excel 2003, 2007 and 2010 1. To calculate the distinct number of clients who have placed orders 2. Select cell B18 and enter the following formula: =SUM(IF(FREQUENCY(B2:B17,B2:B17)0,1)). 3. The answer will be 10.That is the count of unique values in the range B2:B17. This formula ignores blank cells and applies to numeric values only. Tip 25: Distinct Count