NEW!
Read the July Issue Online.
Subscribe today
Subscribe
> Top Jobs
> Country House Hotels
> Spa Hotels

2008 Salary Survey
Download PDF Click Here

Excel functions

Helen Bradley introduces you to ten handy Excel functions.

At its heart, Excel is a great tool for making calculations and Excel functions are the key to getting the work done fast. In this article, I’ll look at some of the most effective functions that Excel has that help you make calculations using worksheet data.

Status bar calculations
One of the handiest calculation tools in Excel isn’t a function but appears automatically on the Status Bar. Select a series of numbers and in the Status Bar you will see, by default, the Sum of those numbers. Right click the Sum and you can select from other calculations such as Min, Max, Count Items, Count and Average. These calculations are useful when you need to quickly check a calculation.

Calculating Averages
The AVERAGE function can be used to calculate the average of a series of numbers. The syntax is =AVERAGE(StartCell:EndCell), where StartCell is the first cell in the range and EndCell is the last cell. Be aware that when you make an AVERAGE calculation, blank (empty cells) are ignored. So, for example, the average of four cells, three of which contain the number four and one of which is blank, is four. If you place a zero in the empty cell then the Average is 3. If you intend blank cells to represent the value zero you should place a zero in all empty cells before making the calculation.

Date functions
Two of Excel’s functions =NOW() and =TODAY() allow you to insert the current date and time or just the current date into a cell. If you do this and see a number of around 39,000 this is the number of days since the 1st of January 1900 and is how dates are calculated. Simply format this number as a date using the Format > Cell > Number Format options.

Calculating workdays
To calculate the number of days between two dates and taking into account holidays use the =NETWORKDAYS function. Start by placing the dates for the holidays in a range of cells across a row or down a column. Select this range and name it holidays using Insert > Name > Define. This function will calculate the number of workdays between two dates placed in cell A1 and A2, taking into account the days you’ve described as being holidays:
=NETWORKDAYS(A1,A2,Holidays)
If the NETWORKDAYS function returns an error make sure that you have the Analysis Toolpak installed by choosing Tools > Add-ins and enable its checkbox.

The NetWorkDays function calculates the number of workdays between two dates taking nominated holidays into account.

You can create your own custom functions using VBA which can be used in the current workbook.

The conditional sum function will sum values only if they meet a specified condition.

Referring to a cell
One difficulty which stumps even seasoned Excel users is how to refer to the contents of one cell in the current cell. For example, if cell A2 should contain the same contents as cell C2 simply type =C2 in cell A2.
Linking cells like this ensures that when the value in C2 changes, the value in cell A2 will change to match it. You can achieve a similar result across worksheets by prefixing the cell reference with the worksheet name.
For example, this formula refers to the contents of cell C2 on Sheet1: =Sheet1!C2.

Multiply and Add
Often when you are making calculations you need to multiply the contents of one column by the values in a second column and then add the results. You might do this, for example, if you have a list of product numbers in stock and you need to multiply these by the cost price and sum it to obtain an inventory value.
To do this use the SUMPRODUCT function, the syntax of which is =SUMPRODUCT(FirstRange,SecondRange).
For example, =SUMPRODUCT(A2:A25,B2:B25) will multiply each of the cells in the range in column A by the corresponding cell in the range in column B and then total the result.

Making choices
The IF function lets you make a choice in your worksheet. For example, if cell A2 contains a value of Y or N depending on whether a discount is applicable, you can use the value in that cell to calculate the discount in another cell. If the discount is 10% this formula will calculate the discount on a price in cell A3:
=IF(A2 =”Y”,0.1*A3, 0)
The formula checks cell A2 to see if a discount is to be allowed and, if so, the discount is calculated using the total price in cell A3. If not, the discount is set to 0.

Finding Roots
Excel has a special function SQRT for finding the square root of a number. So, for example, the square root of 25 can be calculated using =SQRT(25). There is, however, no corresponding function for calculating the cube or any other root of a number. You can, however, calculate this using a simple formula if you know that the square root of 25 can be written mathematically as =25^(1/2). By extension, the cube root can be calculated by typing =25^(1/3).

DIY functions
It is possible to create your own functions in Excel. Choose Tools > Macros > Visual Basic Editor and, in the Project - VBA Project pane, select the current file and choose Insert > Module. Type this function into the dialog and return to your worksheet:
Function Commission(Sales) As Currency
    Commission = Sales * 0.05
If Commission > 1000 Then
    Commission = 1000
End If
End Function

To test your function type this formula into a worksheet:
=COMMISSION(20000)
The function calculates commission at 5% of the amount of sales. If the 5% value is more than £1000 then the commission is pegged at this amount - to check this, test the function with a very large number. Functions created this way are only able to be used in the current workbook.

Summing conditionally
In some instances you may want to sum a column of numbers depending on the contents of that column. For example, if you want to total the sales figures in the range B3:B35 but only where those values are greater than 100, this SUMIF formula will do the work:
=SUMIF(B3:B35,”>100”)
As you can see there are plenty of functions in Microsoft Excel to help you produce spreadsheet results without having to do a lot of effort in making the calculations manually. In addition to speed, another benefit of using functions like these is that they automatically update when the data in the worksheet changes.