Microsoft Excel 2007-Intermediate II

Embed Size (px)

Citation preview

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    1/35

    Prepared by: Elyza CH

    Microsoft Excel 2007 Intermediate II

    FORMULAS AND FINANCIAL FUNCTIONS

    Text Functions in Excel1. Functions to Remove Extra Characters

    The Excel TRIM Function

    ExampleThe example below shows the Trim function used on four different text strings.

    In all four of the above cases, the result is the string

    "trim text"

    - with no spaces at the start or end and just one space in the middle.

    2. Replacing / Substituting Parts of a Text String

    The Excel REPLACE Function

    ExampleThe following spreadsheets show examples of use of the Excel Replace Function. The spreadsheet on the left

    shows the format of the functions and the spreadsheet on the right shows the results.

    Formulas Result

    3. Functions to Convert Excel Data Types

    1

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    2/35

    Prepared by: Elyza CH

    The Excel BAHTTEXT Function

    ExamplesThe following spreadsheet shows examples of the Excel Bahttext function. The format of the function is shown in

    the spreadsheet on the left and the result is shown in the spreadsheet on the right.Formulas Results

    TheThe Excel FIXED Function

    ExampleThe spreadsheet below shows examples of use of the Excel Fixed Function. The spreadsheet on the left shows

    the format of the functions and the spreadsheet on the right shows the results.

    Formulas Results

    The Excel TEXT Function

    ExampleOne of my most common uses of the Excel TEXT function is to incorporate dates into text strings.

    For example, in the spreadsheet below, if I want to join together a name and a date of birth, using the simple &

    operator will not give me the result I want. This is shown in the spreadsheet below, in which cell C2 uses thesimple formula :- =A2 & " " & B2 to join together the name in cell A2 and the date of birth in cell B2:

    This result is returned because Excel is showing the underlying value of cell B2 which is an integer.

    In order to show the name, followed by the date of birth, we need to request the value of B1 to be formatted as a

    date. This can be done using the Excel TEXT function, as shown in the example below. The first spreadsheet

    shows the formula and the lower spreadsheet shows the result.Formula

    Result

    The Excel VALUE Function

    Examples

    2

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    3/35

    Prepared by: Elyza CH

    The following spreadsheet shows the VALUE function being used for four different examples. Note that, in the

    example spreadsheet, the values in cells A2 - A4 are all text values. The spreadsheet on the left shows the format

    of the function and the spreadsheet on the right shows the results :

    Formula Result

    It is seen, from the examples above, that the Excel VALUE function can interpret different formats of numbers.

    For example,

    in the example in cell B2, the function understands the text value "1.0E-07" to represent the scientific

    notation for the number 0.0000001

    in the example in cell B2, the function understands the text value "50,000" to represent the number 50000

    However, in the example in cell B4, the VALUE function is not able to interpret the currency $ symbol as part of a

    number, so it produces the #VALUE! error message.

    4. Cutting Up & Piecing Together Text Strings

    The Excel CONCATENATE Function

    ExampleThe example below shows the function being used to 'CONCATENATE' the text strings in columns A & B of the

    example spreadsheet.

    A B C D

    1 Name Age DOB Combined Details

    2 Jane SMITH 24 29/02/84=CONCATENATE(A2,", Age ",B2)

    3 Dominic DAY 35 31/05/73=CONCATENATE(A3,", DOB: ",C3)

    4 James KAY 21 02/02/87=CONCATENATE(A4,", DOB: ",TEXT(C4,"dd/mm/yy"))

    Note that, in the example above, text blocks have been added to separate the different fields. For example, in cell

    D2, the text block ", Age "has been used to separate the name and age.

    Also note that in cell D3, the DOB is shown as the number 26815. This is because dates (and times) in Excel are

    represented as numbers. It is only the formatting of cells that makes dates appear in the date format. The number

    26815 is the numeric value associated with the date 31st May 1973 and so this is the value that the function

    retrieves from cell C3.

    In cell D4, the date of birth is displayed in a date format. This has been done with the use of the TEXT function,which is used to translate the number 26815 into a text string in the date format "dd/mm/yy".

    The spreadsheet below shows the results of the three CONCATENATE functions in cells D2 - D4.

    A B C D

    1 Name Age DOB Combined Details

    2 Jane SMITH 24 29/02/84Jane SMITH, Age 24

    3 Dominic DAY 35 31/05/73Dominic DAY, DOB: 26815

    4 James KAY 21 02/02/87James KAY, DOB: 02/02/87

    The Excel LEFT Function

    3

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    4/35

    Prepared by: Elyza CH

    ExampleThe following example shows the function applied to the values in cells B1 - B4 of the example spreadsheet.

    A B C

    1Call to 'LEFT' with the num_charsargument unspecified (default value = 1):

    Original Text =LEFT(B1)

    2Call to 'LEFT' with num_charsset to 4:

    Original Text =LEFT(B2, 4)

    3Call to 'LEFT', combined witha call to the FIND function:

    Original Text =LEFT(B3, FIND(" ",B3)-1)

    4Call to 'LEFT', where the result is a digit(which is stored as text by Excel)

    5 bags of coal =LEFT(B4)

    The third example (in cell C3) uses theFIND function, combined with the LEFT function. In this case,

    the num_charsargument takes on the value returned by FIND(" ",B3)-1 (ie. the position of the character before the

    first space in the supplied text).

    The results of the 4 Excel LEFT functions are shown in the spreadsheet below.

    A B C

    1Call to 'LEFT' with the num_charsargument unspecified (default value = 1):

    Original Text O

    2Call to 'LEFT' with num_charsset to 4:

    Original Text Orig

    3Call to 'LEFT', combined witha call to the FIND function:

    Original Text Original

    4Call to 'LEFT', where the result is a digit(which is stored as text by Excel)

    5 bags of coal 5

    As previously mentioned, the value of "5" that has been returned in cell C4 is actually recognised by Excel as text.

    Therefore, Excel will not recognise this as a numeric value unless it is converted to a number. One way of doing

    this is by using the VALUE function.

    The Excel MID Function

    ExampleThe following example shows the function applied to the values in cells B1 - B4 of the example spreadsheet.

    A B C

    1Call to 'MID' with start_num setto 4 and num_chars set to 3:

    Original Text =MID(B1,4,3)

    2Call to 'MID' with start_numset to 10 and num_chars set to 3:

    Original Text =MID(B2,10,3)

    3Call to 'MID', combined with theFIND function:

    Original Text =MID(B3,FIND("T",B3),3)

    4Call to 'MID', where the result is a digit(which is stored as text by Excel)

    I have 5 bags =MID(B4,8,1)

    The third example (in cell C3) uses theFIND function, combined with the MID function. In this case,the num_charsargument takes on the value returned by FIND("T",B3) (ie. the position of the "T" in the supplied

    text).

    The results of the 4 Excel MID functions are shown in the spreadsheet below.

    A B C

    1Call to 'MID' with start_num setto 4 and num_chars set to 3:

    Original Text gin

    2 Call to 'MID' with start_num Original Text Tex

    4

    http://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.html
  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    5/35

    Prepared by: Elyza CH

    set to 10 and num_chars set to 3:

    3Call to 'MID', combined with theFIND function:

    Original Text Tex

    4Call to 'MID', where the result is a digit(which is stored as text by Excel)

    I have 5 bags 5

    As previously mentioned, the value of "5" that has been returned in cell C4 is actually recognised by Excel as text.

    Therefore, Excel will not recognise this as a numeric value unless it is converted to a number. One way of doing

    this is by using the VALUE function.

    The Excel REPT Function

    ExamplesThe following spreadsheet shows several examples of the Excel Rept function. The format of the function is

    shown in the spreadsheet on the left and the result is shown in the spreadsheet on the right.Formulas Results

    Note that in the above examples:

    In cell B2, the Number_times argument is set to 0, so the Rept function returns the empty string

    In cell B4, the the '&' operator has been used with the Rept function, to join together different text strings

    5. Functions to Convert Between Upper & Lower Case

    The Excel LOWER Function

    ExampleThe spreadsheet below shows examples of use of the Excel Lower Function. The spreadsheet on the left shows

    the format of the functions and the spreadsheet on the right shows the results.

    Formulas Results

    The Excel PROPER Function

    ExampleThe spreadsheet below shows examples of use of the Excel Proper Function. The spreadsheet on the left shows

    the format of the functions and the spreadsheet on the right shows the results.

    Formulas Results

    5

    http://www.excelfunctions.net/FindFunction.htmlhttp://www.excelfunctions.net/FindFunction.html
  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    6/35

    Prepared by: Elyza CH

    The Excel UPPER Function

    ExampleThe spreadsheet below shows examples of use of the Excel Upper Function. The spreadsheet on the left shows

    the format of the functions and the spreadsheet on the right shows the results.

    Formulas Results

    6. Information Functions

    The Excel LEN Function

    ExamplesThe examples below show the 'LEN' of the two text strings in column B of the example spreadsheet. Note that the

    text in column B is underlined, so that you can easily see where the spaces are.

    A B C

    1Cell B1 contains just one spacebetween words:

    Text String =LEN(B1)

    2Cell B2 has one space betweenwords and 4 spaces at the end:

    Text String =LEN(B2)

    The results of the LEN function, applied to cells B1 to B2 ofthe example spreadsheet, are shown below. Note that

    the function includes spaces, in its calculated length, as well as other characters.

    A B C

    1Cell B1 contains just one spacebetween words:

    Text String 11

    2

    Cell B2 has one space between

    words and 4 spaces at the end:

    Text String 15

    The Excel Exact Function

    ExamplesThe following spreadsheet shows several examples of the Excel Exact function. The format of the function is

    shown in the spreadsheet on the left and the result is shown in the spreadsheet on the right.

    Formulas Results

    6

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    7/35

    Prepared by: Elyza CH

    Note that, in the above examples:

    As the Excel Exact function is case-sensitive, the function in cell C2 returns FALSE The time 12:00 (in cell B4) actually has the underlying value of 0.5 in Excel. Therefore the values in cells

    A4 and B4 are exactly equal - it is just the formatting of these two cells that is different.

    The Excel T Function

    ExamplesThe following spreadsheet shows several examples of the Excel T function. The format of the function is shown in

    the spreadsheet on the left and the result is shown in the spreadsheet on the right.Formulas Results

    Note that, in cells B2 and B3 of the above example spreadsheet, the T function returns an empty string. This is

    because the supplied arguments are the number 25 and the logical value FALSE, not text values.

    Logical Functions in Excel

    1. Boolean Operator Functions

    The Excel AND Function

    ExamplesThe following examples show the AND function applied to a number of different conditions. The format of the

    functions are shown in the spreadsheet on the left and the result is shown in the spreadsheet on the right

    A B C

    1 5 10=AND( A1>0, A10, A212 )

    3 5 10=AND( A3B3, B3>12 )

    A B C

    1 5 10 TRUE

    2 5 10 FALSE

    3 5 10 FALSE

    In the examples above, the function in cell C1 evaluates to TRUE, as BOTH of the supplied conditions are TRUE

    the function in cell C2 evaluates to FALSE, as the third condition, B2>12, is FALSE

    the function in cell C3 evaluates to FALSE, as ALL of the supplied conditions are FALSE

    The Excel OR Function

    ExamplesThe following examples show the OR function applied to a number of different conditions. The format of the

    functions are shown in the spreadsheet on the left and the result is shown in the spreadsheet on the right.

    A B C

    1 5 10 =OR( A1>0, A1

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    8/35

    Prepared by: Elyza CH

    2 5 10 =OR( A2>0, A2>B2, B2>12 )

    3 5 10 =OR( A3B3, B3>12 )

    2 5 10 TRUE

    3 5 10 FALSE

    In the examples above,

    the function in cell C1 evaluates to TRUE, as BOTH of the supplied conditions are TRUE

    the function in cell C2 evaluates to TRUE, as the first condition,A2>0, is TRUE

    the function in cell C3 evaluates to FALSE, as ALL of the supplied conditions are FALSE

    The Excel NOT Function

    ExamplesThe following spreadsheets show examples of the NOT function. The spreadsheet on the left shows the format of

    the functions and the spreadsheet on the right shows the results :

    2. Conditional Functions

    The Excel IF Function

    Example 1The following example shows the Excel IF function applied to two sets of numbers. Within the function,

    the Logical_testchecks whether the value in column C is equal to 0, and depending on the result, the function

    returns the following:

    If the value in column B is equal to 0, the result of the function is set to #N/A. (In the example, Excel's

    NA() function is used to return this error value).

    If the value in column B is non-zero, then the function returns the value in column A divided by the valuein column B.

    The format of the IF function is shown in the spreadsheet on the left and the result is shown in the spreadsheet on

    the right.

    A B C

    1 5 4 =IF(B1=0, NA(), A1/B1)

    2 5 0 =IF(B2=0, NA(), A2/B2)

    A B C

    1 5 4 1.25

    2 5 0 #N/A

    Example 2

    The Logical_testwithin the Excel IF function can use any type of expression that returns

    a TRUEorFALSEresult. The following example shows some more examples of the function, using differenttypes ofLogical_test. Again, the format of the function is shown in the spreadsheet on the left and the result is

    shown in the spreadsheet on the right:

    A B

    1 5 =IF(A10, A1, -A1)

    2 -5 =IF(A20, A2, -A2)

    3 0 =IF(ISERROR(1/A3), 1, A3)

    4 test =IF(LEN(A4)0, 1, 0)

    A B

    1 5 5

    2 -5 5

    3 0 1

    4 test 1

    The Excel IFERROR Function

    The Excel IFERROR function tests if an initial supplied value (or expression) returns anExcel Error, and if so,returns a second supplied argument; Otherwise the function returns the initial supplied value.

    8

    http://www.excelfunctions.net/Excel-Formula-Error.htmlhttp://www.excelfunctions.net/Excel-Formula-Error.htmlhttp://www.excelfunctions.net/Excel-Formula-Error.html
  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    9/35

    Prepared by: Elyza CH

    The IFERROR function is new to Excel 2007, so is not available in earlier versions of MS Excel

    The format of the function is:

    IFERROR( Value, Value_if_Error )

    where the arguments are as follows:

    Value The initial value or expression that should be tested

    Value_if_Error Value or expression to be returned if the initial Value argument returns an error

    I personally have found the Excel Iferror function to be a useful addition in Excel 2007. Previously, in Excel 2003,

    whenever I used theVlookup functionI would frequently also use the IF function with theISERROR function to

    test for an error and return an appropriate result. This is shown in the following formula:

    IF( ISERROR(VLOOKUP(...)), "", VLOOKUP(...) )

    the above formula checks if the VLOOKUP function returns an error, and if so, returns a blank (""). Otherwise the

    value of the VLOOKUP is returned. Although this formula is long and inefficient (as it requires 2 seperate calls to

    the VLOOKUP function), it helps to keep my spreadsheet cells tidy and free from messy error messages.

    In Excel 2007, I can perform the above action much more efficiently and neatly, by using the IFERROR function.

    The new formula is written as:

    IFERROR( VLOOKUP(...), "" )

    3. Functions Returning Constant Values

    The Excel TRUE Function

    The Excel TRUE function simply returns the logical value True.

    The function takes no arguments and therefore, the format is simply:

    TRUE()

    Throughout your spreadsheet, instead of calling the TRUE function, you can simply type the text True into your

    spreadsheet, and Excel will interpret this as the logical value True.

    The Excel FALSE Function

    The Excel FALSE function simply returns the logical value False.

    The function takes no arguments and therefore, the format is simply:

    FALSE()

    Throughout your spreadsheet, instead of calling the FALSE function, you can simply type the text False into your

    spreadsheet, and Excel will interpret this as the logical value False.

    Information Functions in Excel

    1. Error Information Functions

    The Excel ISERROR Function

    ExamplesThe following spreadsheets show examples, of the Excel ISERROR function being used to determine whether a

    value or expression returns an error. The spreadsheet on the left shows the formulas used and the spreadsheet

    on the right shows the results :

    9

    http://www.excelfunctions.net/ExcelVlookup.htmlhttp://www.excelfunctions.net/ExcelVlookup.htmlhttp://www.excelfunctions.net/ExcelVlookup.htmlhttp://www.excelfunctions.net/ExcelIf.htmlhttp://www.excelfunctions.net/Excel-Iserror-Function.htmlhttp://www.excelfunctions.net/Excel-Iserror-Function.htmlhttp://www.excelfunctions.net/ExcelVlookup.htmlhttp://www.excelfunctions.net/ExcelVlookup.htmlhttp://www.excelfunctions.net/ExcelIf.htmlhttp://www.excelfunctions.net/Excel-Iserror-Function.htmlhttp://www.excelfunctions.net/ExcelVlookup.html
  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    10/35

    Prepared by: Elyza CH

    In the examples above, the arguments to the ISERROR function calls are :

    Simple values in cells B1 - B3

    Expressions in cells B4 & B5 (note the division by zero in cell B4 will produce the #DIV/0! error)

    Cell references in cells B6 & B7

    The Excel ISERR Function

    ExamplesThe spreadsheets below show examples of the Excel ISERR function. The spreadsheet on the left shows the

    formulas used and the spreadsheet on the right shows the results :

    In the examples above, The arguments to the ISERR function calls are : Simple values in cells B1 - B3 Expressions in cells B4 & B5 (note the division by zero in cell B4 will produce the #DIV/0! error) Cell references in cells B6 - B8

    The Excel ISNA Function

    ExamplesThe following spreadsheet shows examples, of the Excel ISNA function being used to determine whether a value

    or expression returns an error :

    The results of the above function calls are shown in the spreadsheet below :

    10

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    11/35

    Prepared by: Elyza CH

    In the examples above, the ISNA function arguments are :

    Simple values in cells B1 - B3

    Expressions in cells B4 & B5

    Cell references in cells B6 & B7

    Note that :

    In cell B4, the division by zero DOES produce an error, but this is not the #N/A error, so the ISNA function

    returns FALSE

    In cell B5, the value '10' cannot be found in column C, so the VLOOKUP function produces the #N/A error

    The Excel ERROR.TYPE Function

    ExamplesThe following spreadsheets show examples of the Excel Error.Type function. The format of the function is shown

    in the spreadsheet on the left and the results are shown in the spreadsheet on the right.

    Note that the last example, in cell B4, tests the contents of cell A4, which is not an error. Therefore, the

    Error.Type function returns its own error message, #N/A.

    2. Other Data Type Functions

    The Excel ISBLANK Function

    ExamplesThe following spreadsheets shows examples, of the Excel ISBLANK function being used to determine whether a

    cell is empty or not. The format of the function is shown in the spreadsheet on the left and the results are shown

    in the spreadsheet on the right :

    The Excel ISLOGICAL Function

    Examples

    11

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    12/35

    Prepared by: Elyza CH

    The spreadsheets below show examples of the Excel ISLOGICAL function. The spreadsheet on the left shows

    the formulas used and the spreadsheet on the right shows the results :

    The Excel ISREF Function

    ExamplesThe spreadsheets below show examples of the Excel Isref function. The spreadsheet on the left shows the format

    of the function and the spreadsheet on the right shows the results :

    Note that :

    The text value "A1" is not a reference. This needs to be converted using the Indirect function(see cell A5

    of the above example) to make this into a reference.

    The function in cell A6 evaluates to False, as the expression A1 * B1 returns a value.

    3. Numerical Information Functions

    The Excel ISNUMBER Function

    ExamplesThe spreadsheets below show examples of the Excel Isnumber function. The spreadsheet on the left shows the

    format of the function and the spreadsheet on the right shows the results :

    The Excel ISEVEN Function

    ExamplesThe spreadsheets below show examples of the Excel ISEVEN function. The spreadsheet on the left shows the

    formulas used and the spreadsheet on the right shows the results :

    12

    http://www.excelfunctions.net/Excel-Indirect-Function.htmlhttp://www.excelfunctions.net/Excel-Indirect-Function.htmlhttp://www.excelfunctions.net/Excel-Indirect-Function.html
  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    13/35

    Prepared by: Elyza CH

    Note that the examples in cells A1 and A5 above show that the ISEVEN function returns True for a zero, or anempty cell.

    The Excel ISODD Function

    ExamplesThe spreadsheets below show examples of the Excel ISODD function. The spreadsheet on the left shows the

    formulas used and the spreadsheet on the right shows the results :

    The Excel N Function

    ExamplesThe following spreadsheet shows several examples of the Excel N function. The format of the function is shown in

    the spreadsheet on the left and the result is shown in the spreadsheet on the right.Formulas Results

    Note that, in cells B3 of the above example spreadsheet, the date 01/01/2010 is converted to the serial number

    40179. However, this serial number may be different on different systems.

    4. General Information Functions

    The Excel INFO Function

    ExamplesThe following spreadsheets show examples, of the Excel Info function. The format of the function is shown in the

    spreadsheet on the left and the results are shown in the spreadsheet on the right.

    13

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    14/35

    Prepared by: Elyza CH

    Date & Time Functions in Excel

    1. Creating Dates & Times

    The Excel DATE Function

    ExampleThe following spreadsheet shows the function applied to 3 different data sets:

    The resulting three dates are shown in the spreadsheet below (in the date format dd/mm/yyyy).

    Note that the last example, shown in cell D4, also makes use of theLEFT function, to extract the day number, 21,

    from the cell A4. Even though the LEFT function returns a string (rather than an integer), Excel is able to convert

    this string into a number, during its calculation of the DATE.

    The Excel TIME Function

    ExampleThe following spreadsheet shows several different examples of the TIME function. The format of the function is

    shown in the spreadsheet on the left and the results are shown in the spreadsheet on the right :

    The results in column E of the spreadsheet above, are formatted with the Time format hh:mm:ss.

    Also note that, in cell E4, of the example above, the seconds argument is 73. However, the TIME function is able

    to convert this into 1 minute and 13 seconds.

    The Excel DATEVALUE Function

    Examples

    14

    http://www.excelfunctions.net/LeftFunction.htmlhttp://www.excelfunctions.net/LeftFunction.htmlhttp://www.excelfunctions.net/LeftFunction.htmlhttp://www.excelfunctions.net/LeftFunction.htmlhttp://www.excelfunctions.net/LeftFunction.html
  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    15/35

    Prepared by: Elyza CH

    The following spreadsheet shows several examples of the Excel Datevalue function. The format of the function is

    shown in the spreadsheet on the left and the result is shown in the spreadsheet on the right.Formulas Results

    Note that, in the above example spreadsheet, the text string in cell A5 contains just a day and month. In this case

    the returned date will use the current year. As these examples were input into Excel in the year 2010, the

    returned date has the year 2010.

    Formatting

    There is a good chance that your result from the Excel Datevalue function will initially be displayed as a serial

    number (eg. 39814). This is because the cell containing the formula is not formatted to show dates.

    To change the formatting to a date format:

    Highlight the cell(s) to be formatted

    Right click with the mouse Select the Format Cells ... option and ensure the Numbertab is selected

    Under the Category heading, select the option Date. Select a date format from the list on the right and

    click OK

    The Excel TIMEVALUE Function

    ExamplesThe following spreadsheet shows several examples of the Excel Timevalue function. The format of the function is

    shown in the spreadsheet on the left and the result is shown in the spreadsheet on the right.Formulas Results

    Formatting

    There is a good chance that your result from the Excel Timevalue function will initially be displayed as a decimal

    number (eg. 0.0993). This is because the cell containing the formula is not formatted to show times.

    To change the formatting to a time format:

    Highlight the cell(s) to be formatted Right click with the mouse

    Select the Format Cells ... option and ensure the Numbertab is selected

    Under the Category heading, select the option Time and click OK

    2. Extracting The Components of a Time

    The Excel HOUR Function

    ExamplesThe following spreadsheet shows the Excel Hour function applied to several different supplied times. The

    spreadsheet on the left shows the format of the function and the spreadsheet on the right shows the results.Formulas Results

    15

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    16/35

    Prepared by: Elyza CH

    Note that, in the above examples, the time shown in cell A4 is actually a whole day plus the time 05:11:22.Therefore, when supplied with thistime value, the Hour function ignores the full day and simply returns the hour

    value 5.

    The Excel MINUTE Function

    ExamplesThe following spreadsheet shows the Excel Minute function applied to several different supplied times. The

    spreadsheet on the left shows the format of the function and the spreadsheet on the right shows the results.Formulas Results

    The Excel SECOND Function

    ExamplesThe following spreadsheet shows the Excel Second function applied to several different supplied times. The

    spreadsheet on the left shows the format of the function and the spreadsheet on the right shows the results.Formulas Results

    3. Performing Calculations with Dates

    The Excel EDATE Function

    ExampleThe following two spreadsheet snapshots show examples of the EDATE function. The spreadsheet on the left

    shows the function formats and the spreadsheet on the right shows the results.

    Function Format

    Results

    16

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    17/35

    Prepared by: Elyza CH

    Note how you can use negative values for the months argument, to get a date that is before thesupplied start_date. Also note how the function manages to cope with months that do not contain the same daynumber as thestart_date ie. there is no 31st day of November, so the function returns the 30th. Similarly, thefunction can handle the leap year day - returning 28/02/2009 as the date 12 months after 29/02/2008.

    The Excel EOMONTH Function

    Example

    The following two spreadsheet snapshots show examples of the EOMONTH function. The spreadsheet on the leftshows the function formats and the spreadsheet on the right shows the results.

    Function Format

    Results

    Note how you can use negative values for the months argument, to get a date that is before the supplied start_date. Youcan also set the months argument to zero, to get the last day of the original start_date.

    The Excel WORKDAY Function

    ExamplesThe spreadsheets below show simple examples of the Excel Workday function. The format of the function is

    shown in the top spreadsheet and the results are shown in the spreadsheet below.Formulas

    Results

    In the example :

    In cell D2 the Holidays array has been omitted. Therefore the calculation excludes Saturdays and

    Sundays but includes all other weekdays, including the holidays at Christmas and New Year.

    In cells D3 and D4 the Holidays array (in cells B2 - B4) is provided to the Workday function. Therefore the

    calculation excludes Saturdays and Sundays and the listed Christmas and New Year holidays.

    The Excel NETWORKDAYS Function

    ExamplesThe spreadsheets below show simple examples of the Excel Networkdays function. The format of the function isshown in the top spreadsheet and the results are shown in the spreadsheet below.

    17

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    18/35

    Prepared by: Elyza CH

    Formulas

    Results

    In the example :

    The Holidays array has been omitted from the calculation in cell A8. Therefore this result excludesSaturdays and Sundays but includes all other weekdays, including the holidays at Christmas and New

    Year.

    In cells A9 and A10 the Holidays array (in cells B3 - B5) is provided to the Networkdays function.

    Therefore the results in these cells exclude Saturdays and Sundays and the listed Christmas and New

    Year holidays.

    4. Current Date & Time

    The Excel NOW Function

    ExampleThe following example shows use of the NOW function, combined with the IF function, to highlight when an

    appointment is due. The function format is shown in the first spreadsheet and the results at 2 different times are

    shown in the two spreadsheets underneath.

    Spreadsheet Showing Formula

    Result at 15:59hrs on 16/11/2008

    Result at 16:01hrs on 16/11/2008

    In the above example, the current time (returned by the NOW function) is subtracted from the appointment time

    and the result is compared against 1 hour. If the current time is less than 1 hour from the appointment time, thealert is shown; otherwise no text is shown in cell B2. The contents of cell B2 have also been formatted to have red

    18

    http://www.excelfunctions.net/ExcelIf.htmlhttp://www.excelfunctions.net/ExcelIf.htmlhttp://www.excelfunctions.net/ExcelIf.html
  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    19/35

    Prepared by: Elyza CH

    bold text, to make the alert stand out more.

    The Excel TODAY Function

    ExampleThe following spreadsheets show 2 simple examples of calls to the function, 'TODAY', which were made on 16th

    November 2008. The first example shows the function used alone, and the second example shows the function

    used as a part of a formula that calculates the number of days that have passed since 31/12/2007. The

    spreadsheet on the left shows the format of the formulas and the spreadsheet on the right shows the results.

    Formulas

    Results on 16-Nov-08

    5. Extracting The Components of a Date

    The Excel DAY Function

    ExampleThe following example shows the function applied to 3 different dates. The spreadsheet on the left shows the

    format of the function and the spreadsheet on the right shows the returned DAY value, for the 3 dates.

    The Excel MONTH Function

    ExampleThe following example shows the function used to extract the MONTH from 3 different dates. The spreadsheet on

    the left shows the format of the function and the spreadsheet on the right shows the result for the 3 dates.

    The Excel WEEKNUM Function

    ExampleOne use for the Excel Weeknum function is if you have a large number of events and you want to analyse the

    peak weeks throughout the year. The spreadsheet below shows part of a spreadsheet in which the days of

    specific events are stored in column A. The function has then been inserted in every cell of column B, to show the

    week number of each event.

    The function format is shown in the spreadsheet on the left and the results are shown in the spreadsheet on the

    right.Formulas Results

    19

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    20/35

    Prepared by: Elyza CH

    The WEEKNUM data can now be used in an Excel PivotTable, to show the number of events occurring duringeach week. A pivot table made from the small sample ofdata above is shown on the right.

    The pivot table enables you to clearly see that the peakweek for the events is week number 3 (13th-19thJanuary), which accounts for a total of 7 events.

    The Excel WEEKDAY Function

    ExampleOne use for the WEEKDAY function is if you have a large number of events and you want to analyse the peak

    weekdays. The spreadsheet below shows part of a spreadsheet in which the days of specific events are stored in

    column A. The function has then been inserted in every cell of column B, to show the weekday of each date in

    column A. The function format is shown in the spreadsheet on the left and the results are shown in the

    spreadsheet on the right.

    20

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    21/35

    Prepared by: Elyza CH

    Formulas

    Results

    The WEEKDAY data can now beused in an Excel Pivot Table, to showthe frequency of each weekday. Apivot table made from the smallsample of data above is shownbelow.

    TipIf you use the WEEKDAY function with the return_type set to 1 (oromitted and so defaulting to 1), then you can use Excel formattingtodisplay the weekday names instead of showing numbers. Note, this onlyworks with the return_type set to 1.

    To format the weekday to show the weekday name:

    Select the column containing the weekdays Right click on this column with the mouse and

    selectFormat_Cells... from this menu

    Ensure the Number tab is selected select the CategoryCustom Under the Type heading, type ddd

    Click OK

    Note that the column showing the weekdays in the above pivot table has been formatted to show the

    weekdaynames (see tip). The pivot table enables you to clearly see that the peak weekday for the data is

    Tuesday.

    Lookup & Reference Functions in Excel

    1. Functions To Return References to Cell Ranges

    The Excel ADDRESS Function

    ExamplesThe following spreadsheets show simple examples of the Excel ADDRESS function. The format of the function is

    shown in the spreadsheet on the left and the results are shown in the spreadsheet on the right.

    21

    http://www.excelfunctions.net/ExcelFormatting.htmlhttp://www.excelfunctions.net/ExcelFormatting.html
  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    22/35

    Prepared by: Elyza CH

    Note that cell A5 in the above spreadsheet combines the ADDRESS function with the ROW functionandthe COLUMN functionto display the reference to the current cell.

    The Excel OFFSET Function

    Example 1The following spreadsheets shows several examples of the OFFSET function being used to reference different

    cell ranges. In each example, the initial supplied range is highlighted in green and the resulting range that is

    returned by the function is shown in red.

    =OFFSET( B1:B6, 4, 2 )

    (note heightand width argumentsare omitted and so the returnedrange has the same dimensionsas the original range)

    =OFFSET( D3, 1, -2 )

    =OFFSET( B2, 2, 1, 1, 4 )

    =OFFSET( B2, 3, 0, 3, 2 )

    Note that in the above examples, the function returns a cell range. Therefore, if you attempt to display the result in

    a cell, you will get an error message (eg. the first example above returns the range D5:D10 - but if you typed

    "=D5:D10" into a cell you would get an error).

    The following Example shows a practical use of the OFFSET function, where the results of the function are used

    in a further function.

    22

    http://www.excelfunctions.net/Excel-Row-Function.htmlhttp://www.excelfunctions.net/Excel-Row-Function.htmlhttp://www.excelfunctions.net/Excel-Column-Function.htmlhttp://www.excelfunctions.net/Excel-Column-Function.htmlhttp://www.excelfunctions.net/Excel-Row-Function.htmlhttp://www.excelfunctions.net/Excel-Column-Function.html
  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    23/35

    Prepared by: Elyza CH

    Example 2The above examples all return cell ranges, but do not show you ways in which you might make practical use of

    the OFFSET function. This is addressed in the following spreadsheet, which uses the OFFSET function to return

    different cell ranges, depending on the weekday shown in the cell B1 and then uses the returned range in a

    further calculation :

    In the above spreadsheet, the OFFSET function is used in cells B2 and B3, to reference the sales figures for the

    weekday selected in cell B1. In both cells, the function uses the same arguments.

    The initial cell range is cell A5. This is the cell from which the offset is applied.

    TheMATCH Functionis used to identify which row (from A6 to A12) contains the weekday shown in cell

    B1. This will give the result, 1 if B1="Sunday", 2 if B1="Monday", etc. This number then supplies

    the rows argument for the OFFSET. (ie. the number of rows to offset from the initial cell, A5).

    The cols argument is set to 1, so the start of the returned cell range is offset 1 column from the start cell,

    A5 (ie. the returned cell range always starts in column B). The heightargument is set to 1, so the returned range is 1 cell high

    The width argument is set to 4, so the returned range is 4 cells wide

    These arguments cause the OFFSET function to return the range of cells containing the sales figures for the

    weekday shown in cell B2. The results from this function are then fed into theSUM Function (in cell B2) and

    the AVERAGE Function (in cell B3), so that these 2 cells show the SUM and AVERAGE of the sales figures forthe selected weekday. The results for the weekday 'Tuesday' are show on the right.

    2. Row / Column / Area Information

    The Excel ROW Function

    ExampleThe following spreadsheets show several calls to the ROW function. The spreadsheet on the left shows the

    format of the function and the spreadsheet on the right shows the results :

    23

    http://www.excelfunctions.net/ExcelMatch.htmlhttp://www.excelfunctions.net/ExcelMatch.htmlhttp://www.excelfunctions.net/ExcelMatch.htmlhttp://www.excelfunctions.net/ExcelSum.htmlhttp://www.excelfunctions.net/ExcelSum.htmlhttp://www.excelfunctions.net/ExcelAverage.htmlhttp://www.excelfunctions.net/ExcelMatch.htmlhttp://www.excelfunctions.net/ExcelSum.htmlhttp://www.excelfunctions.net/ExcelAverage.html
  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    24/35

    Prepared by: Elyza CH

    The Excel COLUMN Function

    ExampleThe following spreadsheets show several calls to the COLUMN function. The spreadsheet on the left shows the

    format of the function and the spreadsheet on the right shows the results :

    The Excel ROWS Function

    ExamplesThe following spreadsheets show simple examples of the Excel ROWS function. The format of the function is

    shown in the spreadsheet on the left and the results are shown in the spreadsheet on the right.

    Note that the formula in cell A3 returns 1,048,576, as this is the number of rows in Excel 2007. If this example

    were run in Excel 2003, it would return 65,536.The Excel COLUMNS Function

    ExamplesThe following spreadsheets show simple examples of the Excel COLUMNS function. The format of the function isshown in the spreadsheet on the left and the results are shown in the spreadsheet on the right.

    Note that the formula in cell A3 returns 16,384, as this is the number of columns in Excel 2007. If this example

    were run in Excel 2003, it would return 256.

    The Excel AREAS Function

    ExamplesThe following spreadsheets show simple examples of the Excel AREAS function. The format of the function is

    shown in the spreadsheet on the left and the results are shown in the spreadsheet on the right.

    Example 2

    24

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    25/35

    Prepared by: Elyza CH

    The following spreadsheet shows another example of the AREAS function, where the Reference is the named

    range 'TestRange', which is made up of the 3 areas shown on the spreadsheet on the left. As shown in the

    spreadsheet on the right, the Areas function returns the result 3.

    3. Data Lookup Functions

    The Excel HLOOKUP Function

    ExampleImagine you have a table of exam results, as shown in the spreadsheet below.

    In a separate spreadsheet, you just want to show the results for one individual. We can use the Excel HLOOKUP

    function to look up the results for the name on the separate spreadsheet.

    This is shown in the example spreadsheet below, which uses the Excel HLOOKUP to look up the exam results for

    'Cara'. The spreadsheet on the left shows the format of the Hlookup function and the spreadsheet on the right

    shows results. Note that, in this example, the overall results table is located in a separate worksheet, called'Results', within the current workbook :

    In the above example, the Hlookup function searches through the top row of the table_array(the range B2:G6 onthe 'Results' worksheet), to find a match for the value in cell B2 (currently set to 'Cara'). when it finds the name

    'Cara', it returns the value from the requested row.

    This is illustrated on the right for the function in cell B6. The function finds the name 'Cara' in the top row ofthe table_arrayand then returns the value from the 5th row of the table_array.

    25

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    26/35

    Prepared by: Elyza CH

    If we change the name in the individual spreadsheet from 'Cara' to 'Ed', the Hlookup functions would

    automatically recalculate the functions to display the exam results for Ed.

    The Excel VLOOKUP Function

    ExampleImagine you are the manager of a local shop or convenience store. In the example below, the 'Supplier Costs'

    spreadsheet shows a list of goods from one of your suppliers, with the wholesale purchase cost and the 'Order'

    spreadsheet shows a list of supplies that you currently require.You want to enter the cost of each item into

    column C of your 'Order' spreadsheet, so that you can work out how much the order will cost.

    You can use the Excel

    VLOOKUP function to 'look

    up' the order number on the

    'Supplier Costs' spreadsheet

    and insert each item price

    into column 'D' of your

    'Order' spreadsheet. The

    following spreadsheet shows

    the format of the Excel

    VLOOKUP function in thiscase:

    A B C D E F G

    1Item Code

    Item Description QuantityOrdered

    Cost ($)

    2 102Tinned Tuna 20=VLOOKUP(A2,'Supplier Costs'!A:C,3,0)

    3 106Tinned Baked Beans 50 $0.32

    4 107White Sliced Loaf 20 $0.55

    5 103Cornflakes 10 $1.55

    In this example, the

    arguments for the ExcelVLOOKUP function are :

    A2 The lookup_value is set to A2, indicating that we want to 'look up' the value of the cell A2(ie. the item code 102) in the 'Supplier Costs' spreadsheet

    'Supplier Costs'!A:C The table_arrayargument is set to 'Supplier Costs'!A:C indicating that the array we wishto search is contained within columns A-C of the worksheet named 'Supplier Costs'

    Note:

    - In this example, the 'Supplier Costs' worksheet is in the same workbook as the currentworksheet (the 'Costs' worksheet). If this sheet was located in a separate workbook,the table_arrayargument would need to include the name of the other workbook.However, you don't need to worry about remembering the formats for referencing otherworkbooks, as you can easily insert the required range by highlighting it, using the mouse.

    3 The col_index_number is set to 3, indicating that the value we want the function to returnlies in the 3rd column of the table_array(ie. we want to return the Item Cost, which is in the3rd column of the supplied range'Supplier Costs'!A:C

    0 In the above example, the range_lookup argument is set to 0, indicating that we only wantthe Excel VLOOKUP function to return a value if it finds an exact match to the item code.

    - Obviously, we wouldn't want the function to return the cost of a different item, if the itemwe are looking for is not found!

    The Excel LOOKUP Function

    Example of the VECTOR Form of the LOOKUP Function

    26

    Supplier Costs:

    A B C

    1 Item Code Item Description Cost ($)

    2 101Tinned Tomatoes 450g $0.30

    3 102Tinned Tuna 190g $0.65

    4 103Cornflakes 500g $1.55

    5 104Shortcake Biscuits 200g $0.42

    6 105Toothpaste 100ml $1.23

    7 106Tinned Baked Beans 450g $0.32

    8 107White Sliced Loaf 800g $0.55

    9 108Frozen Beef Lasagne $1.65

    Order:

    A B C D

    1Item Code Item Description

    QuantityOrdered

    Cost ($)

    2 102Tinned Tuna 20

    3 106Tinned Baked Beans 50

    4 107White Sliced Loaf 20

    5 103Cornflakes 10

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    27/35

    Prepared by: Elyza CH

    Imagine you are compiling a list of examination results for a class of students. You have a list that tells you what

    grade is assigned to different percentages scores and you have a separate list of percentages that each student

    scored in the exam. You need to allocate a grade to each student's examination mark. This is shown in the 2

    spreadsheets below:Grades Spreadsheet

    A B C

    1 Lower Upper Grade

    2 0% 34% F

    3 35% 44% E4 45% 54% D

    5 55% 64% C

    6 65% 75% B

    7 75% 100% A

    Exam Results Spreadsheet

    A B C

    1 Name Percentage Grade

    2 ASH, Kelly 57%

    3 AVIS, Ben 86%4 BUX, David 46%

    5 CRAY, John 29%

    The Excel LOOKUP function can be used to 'look up' the grade that is associated with the percentage that was

    scored by each student. The formula for this is shown in the spreadsheet below.

    A B C D E F G

    1 Name Percentage Grade

    2 ASH, Kelly 57%=LOOKUP( B2, Grades!A$2:A$7, Grades!C$2:C$7 )3 AVIS, Ben 86%=LOOKUP( B3, Grades!A$2:A$7, Grades!C$2:C$7 )

    4 BUX, David 46%=LOOKUP( B4, Grades!A$2:A$7, Grades!C$2:C$7 )

    5 CRAY, John 29%=LOOKUP( B5, Grades!A$2:A$7, Grades!C$2:C$7 )

    The above formula will only work if the lookup_vector(i.e. the 'Lower'column) is ordered numerically.The results of the above calls to the LOOKUP function are shown inthe spreadsheet below. As expected, the function has successfullyreturned the exam grade linked to each student.

    Note:The $ symbol used in the termsA$2:A$7 and C$2:C$7 prevents thereferences to vectors A2:A7 andC2:C7 from automatically adjusting(eg. to A3:A8, A4:A9, etc), as theformula is copied down to other cells.

    A B C

    1 Name Percentage Grade

    2 ASH, Kelly 57% D

    3 AVIS, Ben 86% A

    4 BUX, David 46% E

    5 CRAY, John 29% F

    Note that the VECTOR form of the Excel LOOKUP function can be used with any two sets of data that have one-

    on-one matching values. For example, two rows of data, or even a column and a row would work, as long as

    the lookup_vectorwas ordered (alphabetically or numerically), and the two data sets were the same length.

    The ARRAY Format of the Excel LOOKUP Function

    The ARRAY form of the Excel LOOKUP function 'looks up' a supplied value in the first row or column of a

    supplied data array (ie. a 2-dimensional table of data) and returns the corresponding value from the last row or

    column of the array.

    The format of the function is:

    LOOKUP( lookup_value, array)

    where the arguments are as follows:

    lookup_value the value that we want to look up in the supplied data array

    array a 2-dimensional array (or table) of data which contains the lookup_value in the first rowor column and the values to be returned in the last row or column

    Example of the ARRAY Form of the LOOKUP Function

    27

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    28/35

    Prepared by: Elyza CH

    Imagine you are in charge of a number of savings accounts, which earn varying rates of interest, depending upon

    the account balance. The interest rates are:

    3% on accounts with a balance of less than $100

    4% on accounts with a balance between $100 and $1,000

    5% on accounts with a balance between $1,000 and $10,000

    6% on accounts with a balance between $10,000 and $50,000

    7% on accounts with a balance of over $50,000

    This is shown in the spreadsheet below:

    A B C D E F

    1 Lower Balance $0.00 $100.00 $1,000.00 $10,000.00 $50,000.00

    2 Upper Balance $99.99 $999.99 $9,999.99 $49,999.99

    3 Interest Rate 3% 4% 5% 6% 7%

    A B C

    1 Account Balance Interest Rate

    2 12-34-56 10000001 $75,000

    3 12-34-56 20000002 $25,000

    4 12-34-56 30000003 $2755 12-34-56 40000004 $35

    6 12-34-56 50000005 $1,005

    Imagine you also have a spreadsheet (see right) which contains a list of bank accounts and the balance for each

    account. You want to look up the interest rate that will be applied to each of these accounts.

    The spreadsheet below shows the array form of the Excel LOOKUP function, used 'look up' the interest rate from

    the 'Rates' spreadsheet and insert this into column C of the 'Accounts' spreadsheet.

    A B C D E

    1 Account Balance Interest Rate

    2 12-34-56 10000001 $75,000=LOOKUP( B2,Rates!B$1:F$3 )

    3 12-34-56 20000002 $25,000=LOOKUP( B3,Rates!B$1:F$3 )4 12-34-56 30000003 $275=LOOKUP( B4,Rates!B$1:F$3 )

    5 12-34-56 40000004 $35=LOOKUP( B5,Rates!B$1:F$3 )

    6 12-34-56 50000005 $1,005=LOOKUP(B6 ,Rates!B$1:F$3 )

    The results of the Excel LOOKUP function are shown in the spreadsheet below. As required, the function has

    inserted the interest rate relating to the balances in each of the listed bank accounts.

    A B C

    1 Account Balance Interest Rate

    2 12-34-56 10000001 $75,000 7%

    3 12-34-56 20000002 $25,000 6%

    4 12-34-56 30000003 $275 4%

    5 12-34-56 40000004 $35 3%

    6 12-34-56 50000005 $1,005 5%

    In this example, the Excel LOOKUP function recognised that it was searching for the lookup_value in the

    first row of the supplied array, and returning a value from the last row. However if the array is transposed so that

    the data runs down 3columns, the function will recognise this, and will still return the correct values.

    The Excel GETPIVOTDATA Function

    Examples

    The examples below all refer to the following Pivot Table, which is located in columns A - G of the current Excel

    Worksheet.

    A B C D E F G

    28

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    29/35

    Prepared by: Elyza CH

    1

    2 Sum of Invoice Amount TotalItem Type

    3 Date Salesperson Digital TV DVD PlayerIPod Computer Grand Total

    4 Jan John $68,600 $13,800 $6,840 $69,600 $158,840

    5 Kevin $64,400 $7,800 $12,780 $36,800 $121,780

    6 Pete $46,200 $2,400 $2,700 $25,600 $76,900

    7 Jan Total $179,200 $24,000 $22,320 $132,000 $357,520

    8 Feb John $68,600 $8,400 $9,720 $52,800 $139,520

    9 Kevin $61,600 $4,500 $7,920 $43,200 $117,220

    10 Pete $29,400 $3,900 $6,300 $33,600 $73,200

    11 Feb Total $159,600 $16,800 $23,940 $129,600 $329,940

    12 Mar John $71,400 $9,300 $7,560 $80,000 $168,260

    13 Kevin $70,000 $10,200 $13,680 $58,400 $152,280

    14 Pete $43,400 $5,400 $3,240 $40,800 $92,840

    15 Mar Total $184,800 $24,900 $24,480 $179,200 $413,380

    16 Grand Total $523,600 $65,700 $70,740 $440,800 $1,100,840

    17

    =GETPIVOTDATA( "Invoice Amount", $A$2, "Date", "Jan" )- Returns the value $357,520, which is the value of the Invoice Amount Total for all of the Date field, "Jan".

    =GETPIVOTDATA( "Invoice Amount", $A$2, "Date", "Feb", "Item Details", "IPod" )

    - Returns the value $23,940, which is the value of the Invoice Amount Total for the Date field, "Feb" and the Item

    Details field, "IPod".

    =GETPIVOTDATA( "Invoice Amount", $A$2, "Date", "Feb", "Item Details", "IPod", "Salesperson", "Kevin" )

    - Returns the value $7,920, which is the value of the Invoice Amount Total for the Date field, "Feb", the Item

    Details field, "IPod", and the Salesperson field "Kevin".

    =GETPIVOTDATA( "Invoice Amount", $A$2, "Item Details", "IPod", "Salesperson", "Kevin" )

    - Returns the Excel #REF! error as the Pivot Table doesn't show the totals for the Salesperson "Kevin".

    The Excel CHOOSE Function

    Examples

    Imagine you are working on the spreadsheet below and you want to set the cells in Column B, to have the

    following values, depending on the content of the corresponding cell in Column A.

    1 - red; 2 - blue; 3 - green; 4 - brown; 5 - purple; 6 - orange; 7 - yellow; 8 - grey

    The Excel CHOOSE function can be used to assign the correct value to the cells of Column B, as shown below:

    A B C D E F G H I

    1 4=CHOOSE(A1,"red","blue", "green", "brown", "purple", "orange", "yellow", "grey")

    2 5=CHOOSE(A2,"red","blue", "green", "brown", "purple", "orange", "yellow", "grey")

    3 6=CHOOSE(A3,"red","blue", "green", "brown", "purple", "orange", "yellow", "grey")

    4 7=CHOOSE(A4,"red","blue", "green", "brown", "purple", "orange", "yellow", "grey")

    5 2=CHOOSE(A5,"red","blue", "green", "brown", "purple", "orange", "yellow", "grey")

    6 3=CHOOSE(A6,"red","blue", "green", "brown", "purple", "orange", "yellow", "grey")

    7 1=CHOOSE(A7,"red","blue", "green", "brown", "purple", "orange", "yellow", "grey")

    8 10=CHOOSE(A8,"red","blue", "green", "brown", "purple", "orange", "yellow", "grey")

    9 9=CHOOSE(A9,"red","blue", "green", "brown", "purple", "orange", "yellow", "grey")

    10 8=CHOOSE(A10,"red","blue", "green", "brown", "purple", "orange", "yellow", "grey")

    The results of the above Excel CHOOSE functions are shown below:A B

    29

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    30/35

    Prepared by: Elyza CH

    1 4brown

    2 5purple

    3 6orange

    4 7yellow

    5 2blue

    6 3green

    7 1red

    8 8grey

    The Excel MATCH Function

    Example 1

    A B

    1 1=MATCH( 7, A:A, 1 )

    2 3=MATCH( 6, A:A, 1 )

    3 5=MATCH( 7, A:A, 0 )

    4 7=MATCH( 6, A:A, 0 )

    5 9=MATCH( 7, A:A, -1 )

    6 11=MATCH( 6, A:A, -1 )The spreadsheet on the left shows the Excel MATCH function used against a Lookup_Arraythat is in ascending

    order. The spreadsheet includes examples in which the Match_Type argument is set to 1, 0 or -1 and shows the

    results obtained for two different Lookup_Values, one of which is contained in the Lookup_Arrayand one of which

    is not contained in the Lookup_Array.

    The results of the function calls are shown in the spreadsheet below.

    A B C

    1 1 4Returns posn. 4, (relating to the value '7')

    2 3 3Returns posn. 3 (relating to the value '5' ie. the nearestvalue below the Lookup_Value '6')

    3 5 4Returns posn. 4, (relating to the value '7')

    4 7#N/A Returns error, as the Lookup_Value '6' cannot be found

    5 9#N/A Returns error, as column A is not in decending order

    6 11#N/A Returns error, as column A is not in decending order

    Example 2

    A B

    1 11=MATCH( 7, A:A, 1 )

    2 9=MATCH( 6, A:A, 1 )

    3 7=MATCH( 7, A:A, 0 )

    4 5=MATCH( 6, A:A, 0 )

    5 3=MATCH( 7, A:A, -1 )6 1=MATCH( 6, A:A, -1 )

    The spreadsheet on the left shows the Excel MATCH function used against a Lookup_Arraythat is in decending

    order. As in the previous example, the spreadsheet includes examples in which theMatch_Type argument is set

    to 1, 0 or -1 and shows the results obtained for two differentLookup_Values, one of which is contained in

    the Lookup_Arrayand one of which is not contained in the Lookup_Array.

    The results of the function calls are shown in the spreadsheet below. The first two examples produce an incorrect

    result. This is because the Lookup_Array is not in decending order.

    A B C

    1 11 6Returns the incorrect position 62 9 6Returns the incorrect position 6

    30

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    31/35

    Prepared by: Elyza CH

    3 7 3Returns posn. 3, (relating to the value '7')

    4 5#N/A Returns error, as the Lookup_Value '6' cannot be found

    5 33 Returns posn. 3, (relating to the value '7')

    6 13Returns posn. 3 (relating to the value '7' ie. the nearestvalue above the Lookup_Value '6')

    Maths & Trig Functions in Excel

    1. Basic Numeric Information

    The Excel ABS Function

    Examples

    The following spreadsheets show simple examples of the Excel Abs function. The format of the function is shown

    in the spreadsheet on the left and the results are shown in the spreadsheet on the right.Formulas Results

    The Excel SIGN Function

    Examples

    The following spreadsheets show simple examples of the Excel Sign function. The format of the function is shown

    in the spreadsheet on the left and the results are shown in the spreadsheet on the right.

    Formulas Results

    2. Basic Mathematical Operations

    The Excel SUM Function

    Examples

    The following example shows the function used to SUM the same set of numerical values in 4 different ways.

    A B C D E F G H

    1 Score1 Score2 Score3 Score4 Score5 Total Score

    2 8 7 9 6 10 =SUM(8, 7, 9, 6, 10)

    3 8 7 9 6 10 =SUM(A3, B3, C3, D3, E3)

    4 8 7 9 6 10 =SUM(A4:E4)

    5 8 7 9 6 10 =SUM(8, B5, C5:E5)

    31

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    32/35

    Prepared by: Elyza CH

    The result of each of the above SUM functions is 40, as they all calculate the SUM of the same 5 numbers:

    A B C D E F

    1 Score1 Score2 Score3 Score4 Score5 Total Score

    2 8 7 9 6 10 40

    3 8 7 9 6 10 40

    4 8 7 9 6 10 40

    5 8 7 9 6 10 40

    The Excel PRODUCT Function

    Examples

    The following spreadsheet shows four different ways to input the same five numbers into the Excel Product

    function. The example shows how the Numberarguments can be input as:

    - individual numbers

    - number arrays

    - individual cells

    - cell ranges

    ... or a combination of all of these.The spreadsheet on the left shows the format of the functions, and the spreadsheet on the right shows the

    results.Formulas Results

    The Excel MOD Function

    Examples

    The following spreadsheets show simple examples of the Excel Mod function. The format of the function is shown

    in the spreadsheet on the left and the results are shown in the spreadsheet on the right.Formulas Results

    The Excel SUBTOTAL Function

    Example 1

    In this example, the Subtotal function is used to calculate the sum and the average monthly sales per team. All of

    the cells in the range of sales figures are visible, so all values are included in the subtotal calculations :Formulas Result

    32

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    33/35

    Prepared by: Elyza CH

    Note that, in the example above, as all cells are visible, we could have set the Function_num argument to either 9

    or 109 for the sum - both values would give the same result. Similarly, using either 1 or 101 for the average would

    give the same results.

    Example 2

    In this example, the teams have been filtered, using theExcel Autofilter, to show Team 1 only. In this case, the

    Subtotal function's calculations will be for the visible cells only (ie. for Team 1 only) :Formulas Result

    Note that, in the example above, because the rows for Teams 2 & 3 have been filtered out, using the Excel

    Autofilter, we could have used aFunction_num argument of either 9 or 109 to give the same sum, (ie. the sum for

    the Team 1 sales only). Similarly, we could have used either 1 or 101 to give the same the average calculation.

    Example 3In this example, rows 3, 4, 6, 7, 9, and 10 of the spreadsheet have been hidden using row formatting. (ie. by

    highlighting these rows, right clicking with the mouse and selecting Hide).

    In the spreadsheet below, the Subtotal function is used to calculate the sum and the average monthly sales

    across ALL teams. Because we are using the values of 9 and 1 for the Function_num arguments, the hidden

    cells are included in the calculations :Formulas Result

    Note that, in the example above, we could exclude the hidden values from the calculations by using

    the Function_num values of 109 and 101 for the sum and average functions respectively.

    3. Conditional Sums

    The Excel SUMIF Function

    Example 1

    The following example shows the Excel SUMIF function using critia based on text strings, numerical values orlogical values.

    33

    http://www.excelfunctions.net/ExcelFilter.htmlhttp://www.excelfunctions.net/ExcelFilter.htmlhttp://www.excelfunctions.net/ExcelFilter.htmlhttp://www.excelfunctions.net/ExcelFilter.htmlhttp://www.excelfunctions.net/ExcelFilter.htmlhttp://www.excelfunctions.net/ExcelFilter.htmlhttp://www.excelfunctions.net/ExcelFilter.html
  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    34/35

    Prepared by: Elyza CH

    The spreadsheet on the left shows the format of the functions and the spreadsheet on the right shows the results

    from the function calls.

    Equations

    A B C

    1 Monday 500

    2 Tuesday 50

    3 Thursday 100

    4 Friday 100

    5 Thursday 200

    6 5 300

    7 2 200

    8 3 100

    9 4 50

    10 5 100

    11 1 100

    12 0 20013 1 250

    14 1 50

    15

    16 =SUMIF( A$1:A$14, "Thursday", B$1:B$14 )

    17 =SUMIF( A$1:A$14, 5, B$1:B$14 )

    18 =SUMIF( A$1:A$14, ">2", B$1:B$14 )

    19 =SUMIF( A$1:A$14, TRUE, B$1:B$14 )

    20 =SUMIF( A$1:A$14, "TRUE", B$1:B$14 )

    Results

    A B

    1 Monday 500

    2 Tuesday 50

    3 Thursday 100

    4 Friday 100

    5 Thursday 200

    6 5 300

    7 2 200

    8 3 100

    9 4 50

    10 5 100

    11 1 100

    12 0 20013 1 250

    14 1 50

    15

    16 300

    17 400

    18 550

    19 400

    20 1900

    In the above example, the Excel SUMIF function in cell A16 checks the contents of cells A1 - A14. For those cells

    whose contents are equal to the text string "Thursday", the corresponding values from the cells B1 - B14 are

    summed. Since the contents of cells A3 and A5 both equal "Thursday", the function sums the values from the

    corresponding cells B3 and B5, which are 100 and 200 respectively.

    The function calls in cells A17 - A20 are evaluated in a similar way, using the criteria, 'equal to 5', 'greater than 2',

    'equal to TRUE' and 'not equal to TRUE', respectively.

    Example 2

    The following example shows the Excel SUMIF function used to total sales figures for the person named in the

    cell F1. This is done by setting the supplied Criteria to be a reference to cell F1. This causes the function tocompare the contents of cell F1 with the supplied Range (column A of the spreadsheet in the example).

    In the spreadsheet below, the name "John" is typed into cell F1 and so the SUMIF function in cell E2 sums all the

    sales figures that relate to 'John'. This gives the total figure of $19,000.

    If the name in cell F1 is changed to "Peter", "Mary" or "Joanne", the function in cell E2 will total the sales figures

    for these names accordingly.

    A B C D E F

    1 Name Month Sales Total Sales figures for : John

    2 John May $6,000

    =SUMIF( A:A, F1, C:C )3 Peter May $4,000

    34

  • 8/9/2019 Microsoft Excel 2007-Intermediate II

    35/35

    Prepared by: Elyza CH

    4 Mary May $7,000

    5 Joanne May $2,000

    6 John June $3,000

    7 Peter June $1,000

    8 Mary June $1,500

    9 Joanne June $5,000

    10John July $7,000

    11 Peter July $5,000

    12 Mary July $6,000

    13 Joanne July $6,000

    14 John August $3,000

    15 Peter August $4,000

    16 Mary August $5,000

    17 Joanne August $4,000

    To make your spreadsheet more user-friendly, it would be useful to use a validation list to control the contents of

    cell F1 in the above example. This would enable users of the spreadsheet to select the cell value from a drop-

    down list of names and would also prevent users from inserting unexpected data into this cell.