Professional Documents
Culture Documents
Tip 1: Calculating the Number of Months Service for an Employee Tip 2: Using Custom Format Tip 3: Formula Auditing Showing Cell Dependencies Tip 4: Finding the Cell with the Highest Value in a Range Tip 5: Combining Text From Multiple Cells into One Tip 6: Use MATCH and INDEX as an Alternative to The Vertical Lookup Tip 7: Adding Criteria/Conditions to Your Sum Function Tip 8: Sumif Between Workbooks Tip 9: Positive and Negative Numbers Tip 10: Formula to Find Duplicate Values in a Data Range Tip 11: Generating of Random Numbers for Testing of Formulas Tip 12: Convert Function Tip 13: Calculating the Periodic Payment for a Loan Tip 14: Using the PMT Function to Reach a Target Tip 15: The SUMIF Function Tip 16: The SumIF Function Tip 17: Making Forecasts with the Forecast Function Tip 18: IF Function Tip 19: Evaluating Multiple Conditions in a Formula with the Nested IF Statement Tip 20: Using the AND Function to Perform Numerous Logical Tests Tip 21: Trapping Error Messages By Using The IF Error Function Tip 22: Aggregate Function Tip 23: TRIM Function Tip 24: Vlookup Approximate Value Tip 25: Distinct Count 3 4 5 6 9 10 13 15 18 20 21 23 27 31 35 37 39 42 44 46 48 50 53 55 57
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.
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:
2013 Tips & Tricks Ebook | Functions Formulae 7
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.
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.
12
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 related 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.
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.
2013 Tips & Tricks Ebook | Functions Formulae 14
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
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.
18
19
20
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.
Youll 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 youre not altering any of the RANDBETWEEN cells). 3. Select cell B2. Type in =A2*100 and press Enter.
Again, when you hit Enter, youll notice that all values in cells A2 to A7 change to a new, random value.
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.
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 youll 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.
2013 Tips & Tricks Ebook | Functions Formulae 24
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.
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))
2013 Tips & Tricks Ebook | Functions Formulae 26
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.
27
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, were 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.
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, theyre optional values and dont 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.
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.
31
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, were 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.
There isnt 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.
33
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 were trying to determine payments against a future amount, we can now use the [fv] option choose the future value wed like to work to (in this case, cell C3).
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 its a negative amount. 6. Select cell D9, type in =C6 and press Enter.
2013 Tips & Tricks Ebook | Functions Formulae 34
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.
1. Select cell I2, type in the formula =SUMIF(A:A,H2,F:F) and press Enter.
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 dont 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.
You can include up to 127 different range/criteria pairings. In this example, were 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.
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. Youll note in the SUMIFS formula tip in the graphic that from criteria_range2 onwards, the parameters are in square brackets (e.g. [criteria_range2, criteria2]) - 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
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.
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
2. You can use the IF Statement. 3. Use the following formula and copy down =IF(B5>10000,B5*20%,B5*5%). 4. The commission figures will be automatically calculated based on the IF function.
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.
2013 Tips & Tricks Ebook | Functions Formulae 43
Tip 19: Evaluating Multiple Conditions in a Formula with the Nested IF Statement
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.
44
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
Tip 20: Using the AND function to perform numerous logical tests
Expanding the usefulness of other functions that perform logical tests can be achieved with the AND function. One can actually test many different 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(C2>1000,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.
47
48
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
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
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
2013 Tips & Tricks Ebook | Functions Formulae
BEHAVIOUR Ignore nested SUBTOTAL and AGGREGATE functions Ignore hidden rows, nested SUBTOTAL and AGGREGATE functions Ignore error values, nested SUBTOTAL and AGGREGATE functions Ignore hidden rows, error values, nested SUBTOTAL and AGGREGATE functions Ignore nothing Ignore hidden rows Ignore error values Ignore hidden rows and error values
0 or omitted 1 2 3 4 5 6 7
52
2. Select cell B2 and type =Trim(A2) then press enter. Drag the formula down.
As you can see from the data above, all spaces from the text except for single spaces between words have been removed.
2013 Tips & Tricks Ebook | Functions Formulae 54
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.
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.
2013 Tips & Tricks Ebook | Functions Formulae 56
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.
Contact Information
Excel on Steroids http://www.alchemex.com/Training/Courses BI Community http://community.alchemex.com/ BI Blog www.alchemex.com/blog Subscribe to Excel on Steroids Tips & Tricks e-newsletter www.alchemex.com/blog/subscribe/#/exceltips Subscibe to Sage Intelligence Tips & Tricks e-newsletter www.alchemex.com/blog/subscribe/#/sitips Sage Alchemex www.alchemex.com
Connect with us
LinkedIn Group za.linkedin.com/company/sage-alchemex Twitter twitter.com/excelonsteroids Facebook www.facebook.com/excelonsteroids You Tube http://www.youtube. com/user/SageIntelligence G+ (Google Plus) http://gplus.to/SageIntelligence