+ All Categories
Home > Business > Trend Line Guide

Trend Line Guide

Date post: 21-Jan-2015
Category:
Upload: ez-r-stats-llc
View: 1,963 times
Download: 2 times
Share this document with a friend
Description:
Guide for computing and charting trend lines.
Popular Tags:
40
Trend Lines As an Audit Tool Audit Commander
Transcript
Page 1: Trend Line  Guide

Trend LinesAs an

Audit Tool

Audit Commander

Page 2: Trend Line  Guide

Trend Lines with Audit Commander

Audit GuideData analysis made easier…

EZ-R Stats, LLC

Page 3: Trend Line  Guide

Audit Commander

The software described in this document may be freely downloaded and used without restriction. Additional information about the audit software is available at the web site http://ezrstats.com.

All comments and suggestions are welcome.

Page 4: Trend Line  Guide

Trend Lines with Audit Commander

Document History

Revision HistoryRevision Number Revision Date Summary of Changes Author

1.0 9-7-2009 Initial Version M. Blakley

Page 5: Trend Line  Guide

Trend Lines with Audit Commander

Table of Contents1 ABOUT THIS GUIDE .......................................................................................................................... 6

1.1 WHO SHOULD USE IT ........................................................................................................................ 6

1.2 TYPOGRAPHICAL CONVENTIONS ........................................................................................................... 7

1.3 PURPOSE ........................................................................................................................................ 7

1.4 SCOPE ........................................................................................................................................... 8

1.5 INTENDED AUDIENCE ........................................................................................................................... 8

1.6 HARDWARE REQUIREMENTS .................................................................................................................. 8

1.7 SOFTWARE REQUIREMENTS .................................................................................................................. 8

2 GETTING STARTED .......................................................................................................................... 9

3 EXCEL ............................................................................................................................................ 10

3.1 THE “BUILT-IN” FUNCTIONS OF EXCEL ................................................................................................... 10

3.2 EXCEL TREND LINE ......................................................................................................................... 11

3.3 EXCEL SCATTER PLOT ...................................................................................................................... 11

3.4 EXCEL PLOT WITH FORMULA AND REGRESSION STATISTICS .......................................................................... 12

3.5 SETTING UP THE WORK SHEET ............................................................................................................ 12

4 USING AUDIT COMMANDER ......................................................................................................... 13

4.1 EXAMPLE ...................................................................................................................................... 13

4.2 STEP 1 ........................................................................................................................................ 14

4.3 STEP 2 ........................................................................................................................................ 15

4.4 STEP 3 ........................................................................................................................................ 16

4.5 STEP 4 ........................................................................................................................................ 17

4.6 STEP 5 ........................................................................................................................................ 19

4.7 MACRO ......................................................................................................................................... 21

4.8 MACRO ELEMENTS ........................................................................................................................... 23

4.9 CLICK THE “RUN” BUTTON ................................................................................................................. 32

4.10 DATA USED ................................................................................................................................. 33

4.11 SUMMARY .................................................................................................................................... 33

4.12 ADVANTAGES ................................................................................................................................ 33

4.13 DISADVANTAGES ............................................................................................................................ 33

Audit Commander User Guide Copyright 2009 Page 5 of 40

Page 6: Trend Line  Guide

Trend Lines with Audit Commander

1 About this guide

This document is divided into the following chapters:

• Chapter 1 – About

• Chapter 2 – Getting Started

• Chapter 3 – Trend Lines using Excel®

• Chapter 4 – Trend lines using Audit Commander

• Appendix – Contains the code used to produce the charts in this monograph

1.1 Who Should Use It

Auditors, researchers, business analysts and academics who use data analytics to perform their

jobs.

Auditors: can use the techniques here for their audit tests

Researchers: use the software for:

Data analysis

Data mining

Statistical reports and charts

Page 7: Trend Line  Guide

Trend Lines with Audit Commander

1.2 Typographical Conventions

This document uses the following typographical conventions:

Command and option names appear in bold type in definitions and examples.

Screen output and code samples appear in monospace type.

1.3 Purpose

The purpose of this monograph is to briefly describe the uses of trend line for audit testing. The

detail procedures for the use of two software systems are described:

1. Microsoft Excel

2. Audit Commander

Microsoft Excel has “built-in” functions which can be used to perform trend line tests, as well

compute bounds for confidence and prediction intervals. This monograph walks through the

procedures.

Audit Commander also has built-in functions for performing trend line analysis and provides

special purpose charts and reports for the auditor to use in testing transactions and balances.

The auditor does not need special computer skills in order to be able to analyze existing data

and apply a variety of “canned” audit procedures using a menu driven system. Output from the

system can be easily imported into Excel for documentation or further analysis. In many cases

the software outputs the results in chart format as well, to help provide a visual representation of

the results of the audit tests performed.

Development of the software began in August 2005 when the author searched fruitlessly for a

relatively easy to use, economical software package for common data analysis routines needed

by auditors. During its development, suggestions and improvements were made by a variety of

audit practitioners.

More information about the system is available from the website, http://ezrstats.com.

Audit Commander User Guide Copyright 2009 Page 7 of 40

Page 8: Trend Line  Guide

Trend Lines with Audit Commander

1.4 Scope

The purpose of this guide is to explain how to apply trend line tests using Excel or the Audit

Commander. This guide is for version 1.86 of the Audit Commander software.

1.5 Intended audience

The software is intended for use by both internal and external auditors, researchers, students

learning auditing and data mining, business analysts and anyone else interested in data

analytics.

1.6 Hardware requirements

At least 512 MB of memory (more if possible). Minimum disk space is 27 MB.

1.7 Software requirements

Audit Commander works only in Windows XP, Vista or Windows 7. Requires ActiveX Data

Objects which is part of SP1. (ActiveX Data Objects can be downloaded from the Microsoft web

site at no charge)

Page 9: Trend Line  Guide

Trend Lines with Audit Commander

2 Getting Started

There is often a linear relationship between accounting data elements, i.e. as one amount

increases, so too does another accounting data element. Common examples include:

• Heating and cooling expense increases as floor space square footage increases

• Payroll taxes increase as the number of employees increases

• Hospital charges increase as the number of days of stay increases

• Cost of goods sold increase as the number of units sold increases

The examples above are just a very few of the many linear relationships that exist between data

elements. The auditor can test specific data amounts in the populations being tested to

determine if a linear relationship exists.

In this monograph, invoice data for approximately sixty vendors, and consisting of approximately

50,000 detail lines will be analyzed for anomalies, using trend line analysis. The invoice data

includes vendor number, invoice date, invoice amount, etc. Note that all amounts in this

monograph are strictly fictional.

Note that the data is raw data, i.e. there has been no summarization, sorting or other

organization of the data. In order to view any underlying trends in the data, it must first be

summarized and sorted. The trend line analysis routine of the Audit Comander has built in

functions to perform such summarization and sorting.

Audit Commander User Guide Copyright 2009 Page 9 of 40

Page 10: Trend Line  Guide

Trend Lines with Audit Commander

3 Excel

Excel has trend line functionality built into the charting function (scatter plots). However, in order

to perform a trend line analysis, the data must first have been summarized. Once summarized it

can be plotted as a scatter plot, and then a trend line can be placed over the data and the trend

line regression statistics obtained.

Excel has analytical capabilities such as pivot tables. However, to effectively use this capability,

the input data must have already had a certain amount of pre-formatting performed. In the

example shown below, the data has already been summarized before the Excel functions are

applied.

3.1 The “built-in” functions of Excel

A basic trend line test can be performed using the following “built in” functions of Excel:

• Slope – computes the slope of the “best fit” trend line

• Intercept – computes the intercept of the “best fit” trend line

• Correl – computes the coefficient of correlation

The slope formula can be used by typing in the following formula into a cell:

“=slope(known_y, known_x)” where “known-y” and “known-x” are range names or ranges.

The same approach can be used for computing the intercept and the correlation, except

different function names are used, i.e. “intercept” and “correl”. Note that an equal sign “=” must

be the first character in the cell formula

Using the data in the example we obtain the following results for the “best fit” regression line:

Page 11: Trend Line  Guide

Trend Lines with Audit Commander

Slope 182.2285Intercept 2068.807Correlation 0.983043

3.2 Excel Trend Line

These values would then be used to compute a trend line which would have the following

formulae:

Maintenance_cost = $2,068.807 + (182.2286 * number_of_buses)

3.3 Excel Scatter Plot

We can plot the actual data values as a scatter plot:

Number of Buses

0

50000

100000

150000

200000

250000

300000

0 500 1000 1500

Number of Buses

Ann

ual M

aint

enan

ce C

ost

A regression line can then be added, as well as show the regression formula and the r-squared

value. This is done by right mouse clicking on the chart and requesting that a trend line be

added and checking the boxes to display the formula and r values

Audit Commander User Guide Copyright 2009 Page 11 of 40

Page 12: Trend Line  Guide

Trend Lines with Audit Commander

3.4 Excel Plot with formula and regression statistics

Chart Title

y = 182.23x + 2068.8R2 = 0.9664

0

50000

100000

150000

200000

250000

300000

0 500 1000 1500

Number of Buses

Ann

ual M

aint

enan

ce C

ost

The trend amount can be added as a new column of data points on the work sheet using the

function “TREND(known_Y,known_x,this_value)”.

3.5 Setting up the work sheet

Perhaps the simplest approach, due to the complexity of some of the formula, is to define named

ranges on the work sheet for the values to be tested. This provides some flexibility in the event

that the data tested should change.

Named ranges can be specified by using the menu items “Insert|Name|Define” and then specify

the name of the range and the column values which make up the range. In the example

provided, there are two named ranges “known_x” and “known_y”. Note that any name can be

provided. The ranges, in this example are “Data!$c$2:$c$101” and “Data!$b$2:$b$101”.

Page 13: Trend Line  Guide

Trend Lines with Audit Commander

4 Using Audit Commander

4.1 Example

The same calculations and chart can be done using Audit Commander. Audit Commander uses

the formulas above, computed using the Cephes tool from the US Department of Energy. To do

so, the processing parameters are first entered into an Excel macro.

Note: Audit Commander does NOT use any functions or computations provided by Excel.

The macro requires a number of items of information, each of which is described later in this

document.

Examples of usage are provided in the following example. A Microsoft Excel work book contains

a sheet with 49,880 rows of information pertaining to invoices over a period of four years. This

information includes information such as vendor number, invoice amount, invoice date, due date,

etc. The information has not been pre-sorted and is contained in a work book named poext.xls

which can be downloaded from the web site at http://ezrstats.com/online/newinno/Trend.zip.

The purpose of this exercise is to demonstrate various types of trend line analysis that can be

performed, the reasons for the analysis and possible audit conclusions that might be derived

from the analysis.

All of the processing is done using macros which can be readily tailored to other types of trend

line analysis which may be required. A work book with all the macros in this whitepaper can be

downloaded from http://ezrstats.com /online/newinno/Trend.zip . The appendix to this document

includes additional details as to the processing performed.

Audit Commander User Guide Copyright 2009 Page 13 of 40

Page 14: Trend Line  Guide

Trend Lines with Audit Commander

4.2 Step 1

The first step in the analysis is to obtain a trend line for invoice counts, by quarter, for the entire

period. We have selected the option to display the information by State fiscal year, which ends

on June 30. The chart is shown as figure 1.

Figure 1 – Invoice counts by quarter

A review of the chart indicates an upward slope in invoice counts, which could be associated

with increased purchasing activity. The correlation, at 77%, is not strong, which indicates that

there is a fair amount of fluctuation in invoice counts by quarter. One unusual attribute of the

chart is that there appears to be a consistent “spike” in the volume of invoices during the fourth

quarter. This pattern has existed for the last three fiscal years.

Page 15: Trend Line  Guide

Trend Lines with Audit Commander

4.3 Step 2

We can make a very minor change in the processing parameters and see the invoice amount

totals by quarter. A change in the chart type from “count” to “sum” results in the chart shown

in figure 2.

Figure 2 – Invoice totals by quarter

Viewing this chart, it can be seen that the same trend exists, and the correlation, at 83%, is

better. The same “spikes” exist in each of the last three final quarters, but they are less

pronounced.

Audit Commander User Guide Copyright 2009 Page 15 of 40

Page 16: Trend Line  Guide

Trend Lines with Audit Commander

4.4 Step 3

One possible explanation for the “spikes” is that invoices with larger amounts are being

processed. This is easy to check by changing the chart type from “sum” to “max”. Such a chart

should enable us to easily see if, in fact, larger invoice amounts are being processed. When the

chart type parameter is changed from “sum” to “max” the chart in Figure 3 is obtained.

Figure 3 – Maximum invoices by quarter

The chart indicates that invoices have consistently had a maximum of approximately $60,000

and that there is no trend. The correlation is very poor. At 43%, the chart indicates little or no

correlation and a slightly upward trend.

Page 17: Trend Line  Guide

Trend Lines with Audit Commander

4.5 Step 4

At this point, it makes sense to “drill down” and look at specific vendors to see if the pattern

exists with all or just a few. Drill downs can be done using the “Where” parameter in order to

specify a criteria for selection. Additional drill down capability exists for the selection of date

ranges, but the analysis will start by looking only at a particular vendor at a time. The first

vendor selected is the first vendor number, 105313. The result of the chart is shown as Figure 4.

Figure 4 – Transaction totals for vendor 105313

Looking at the chart there appear to be some minor “blips”, but they do not occur in the fourth

quarter. Also, the correlation, at 80% seems better than the overall population, which was 77%.

We then look at the next vendor, 105436 and the results are shown as Figure 5.

Audit Commander User Guide Copyright 2009 Page 17 of 40

Page 18: Trend Line  Guide

Trend Lines with Audit Commander

Figure 5 – Transaction counts for vendor 105436

Looking at the chart there appear to be some significant spikes, all of which occur during the

fourth quarter. This is borne out by the very low correlation amount of 32%. It is fairly easy to do

additional testing through some very minor changes to parameters. For example, we can

change the parameter “count” to “sum” to obtain the invoice totals. If we wish to get even more

granular information, we can change the fiscal period from “sfy” (state fiscal year) to “mon”

(monthly chart). Figure 6 shows the results, when the parameter is changed from count to sum.

Page 19: Trend Line  Guide

Trend Lines with Audit Commander

Figure 6 – Quarterly totals for vendor 105436

Looking at the chart there appear to be some significant spikes, all of which occur during the

fourth quarter. This is borne out by the very low correlation amount of 32%. It is fairly easy to do

additional testing through some very minor changes to parameters. For example, if we wish to

get even more granular information, we can change the chart type from “sfy” (state fiscal year) to

“mon” (monthly chart).

4.6 Step 5

We now change the period to “monthly” in order to look at the monthly amounts. Figure 7 shows

the results, when the fiscal period is changed to “monthly”.

Audit Commander User Guide Copyright 2009 Page 19 of 40

Page 20: Trend Line  Guide

Trend Lines with Audit Commander

Figure 7 – Monthly totals for vendor 105436

This chart shows the invoice totals over a two year period ending June 30, 2005. There was a

more than four fold spike in the amount of invoices processed during the final month of the fourth

quarter (June). The coefficient of correlation, at 24%, is even lower than before because most of

the activity was concentrated in a single month (June) which was significantly larger than the

transaction totals for any other month.

Notice that the process to look at data over a federal fiscal period involves only changing the

FiscalPeriod parameter to “ffy”. The chart in figure 8 shows the data based upon a federal fiscal

year.

Page 21: Trend Line  Guide

Trend Lines with Audit Commander

Figure 8 – Monthly coefficient of correlation for vendor 105436

4.7 Macro

In order to use the macros described, Audit Commander must be “registered” with Windows.

This is done as follows:

• Open an Excel work book

• Start the visual basic editor

Audit Commander User Guide Copyright 2009 Page 21 of 40

Page 22: Trend Line  Guide

Trend Lines with Audit Commander

From the menu, select “Tools|References” and check the box labeled “Electronic work papers –

Audit Commander”.

Page 23: Trend Line  Guide

Trend Lines with Audit Commander

Once box has been checked, then a reference can be made in the macro to the class “cScatter”

which has the trend line chart logic. This can be done using the statement:

Dim oScatter As New cScatter

At this point the remaining elements of the macro can be entered, referring to this class element

named “oScatter” (the name can be any valid name).

4.8 Macro elements

4.8.1 Input file

The name of the file containing the information to be analyzed must be specified. This can be

either an Excel work book or a Microsoft Access database.

An example is as follows, where the a Microsoft Access data base is to be analyzed”:

oScatter.Infile = "c:\temp\mdb\poext.mdb"

4.8.2 Work Sheet or Table

Audit Commander User Guide Copyright 2009 Page 23 of 40

Page 24: Trend Line  Guide

Trend Lines with Audit Commander

If data in an excel work book is being analyzed, then the name of the work sheet which contains

the data must be provided. Note that the worksheet name is followed by a “$”. For example if

the Work Sheet is named “Utility Expenses” then the name would be entered as “Utility

Expenses$”. It also possible to use the name of an Excel named ranged, in which case the “$”

symbol is not used.

If the data is in Microsoft Access, then the name of the table containing the data to be analyzed

must be provided. An alternative is to provide the name of a stored Query.

An example is as follows, where the table is named “poext”:

oScatter.Table= "poext"

4.8.3 Amount Column

The name of the column of data containing the numeric amounts to be analyzed is specified

using the “amtcol” parameter.

An example is as follows, where the amount column is named “invamount”:

oScatter.AmtCol = "Invamount"

4.8.4 Date Column

The name of the column of data containing the transaction dates to be analyzed is specified

using the “datecol” parameter.

An example is as follows, where the date column is the invoice date named “invdate”:

oScatter.DateCol = "Invdate"

4.8.5 Chart output file

The name of the file containing the graphic to be created. The file type must be of type graphic,

which is specified by the file suffix. Common examples include “.png”, “.gif”, “.jpg”, etc. For this

example, the file will be named “t-trendonly” and created as type “png” – portable net work

graphics..

oScatter.ChartFile = "c:\test\scatter\t-trendonly.png"

4.8.6 Selection criteria

Page 25: Trend Line  Guide

Trend Lines with Audit Commander

In some cases, not all records are to be analyzed. For example, the auditor may be interested in

only a particular region, store, vendor, etc. This is done using the “where” criteria. Some

examples are provided below:

'oScatter.where = "invamount > 100"

'oScatter.Where = "invdate > #6-30-2003# "

oScatter.Where = "vendor_number = '105313' "

4.8.7 Log (extract) file

The system logs those records which are selected for analysis. The outfile parameter is used to

specify the name of the file to contain these extract records.

oScatter.Outfile = "c:\test\scatter\t-out.txt"

4.8.8 Chart title

The chart produced can contain a title centered at the top. The “title” parameter is used to

specify the chart title.

oScatter.Title = "Vendor 103251"

Audit Commander User Guide Copyright 2009 Page 25 of 40

Page 26: Trend Line  Guide

Trend Lines with Audit Commander

4.8.9 Aggregate data

The most common type of trend line produced will be for totals by time period. For example, a

file of vendor payments might be analyzed by month, showing the total amounts paid per month.

However, there are a variety of other types of statistics which can be charted as well, such as,

through the specification of an “Aggregate Data” parameter:

Parameter Name DescriptionSum The total amount for the period, i.e. a sum of

each detail amount.Min The minimum amount for the period, i.e. the

smallest value.Max The maximum amount for the period, i.e. the

largest value.Average The average or mean value for the period.Count A count of the number of transactions for the

period.Stdev The standard deviation of the amounts for the

periodRange The range in values for the amounts in a

period, i.e. the difference between the largest

and smallest amounts for the period.

In the example below, the chart plots the sum of the amounts.

oScatter.AggregateData = "sum"

4.8.10 Start date

In some cases, a trend line is needed for just a specific time period, i.e. transactions outside that

period are not to be considered. This is done through the specification of a start and end time.

The start and end dates are entered as a date.

oScatter.StartDate = "5/13/2004"

oScatter.EndDate = "7/20/2007"

4.8.11 X-Axis label

Page 27: Trend Line  Guide

Trend Lines with Audit Commander

To specify the name to be shown at the bottom of the chart, use the parameter “xaxis”. If no

value is provided, then the label is “Date”.

oScatter.XAxis = "Invoice Date"

4.8.12 Chart Type

Three types of charts can be produced:

1. Scatter – shows data points only

2. TrendOnly – shows data points and trend line

3. Trend – data points, trend line and line statistics (slope, intercept, correlation, etc.)

An example parameter to produce a trend chart (without statistics) is:

oScatter.ChartType = "trendonly"

4.8.13 Data label

The data points on the chart can be labeled using the “data” parameter. This label will be shown

on the chart to identify the data being plotted,

An example parameter to label the plotted data points as “invoices” :

oScatter.data = "invoices"

Audit Commander User Guide Copyright 2009 Page 27 of 40

Page 28: Trend Line  Guide

Trend Lines with Audit Commander

4.8.14 Fiscal Period

For data summarized by quarter, a fiscal period can be specified as follows

Value DescriptionSFY State fiscal year (fiscal year ends June 30, 20XX)FFY Federal fiscal year (fiscal year ends September 30,

20XX)CAL Calendar year (ends December 31, 20XX)MON Indicates that data will be summarized monthly, not

quarterlyCORPX Corporate fiscal year ends on the last day of month X,

where X is a number between 1 and 12. For example

“CORP1” signifies a fiscal year ending January 31,

20XX. Note that all of the following are equivalent to

each other (CORP6 = SFY, CORP9=FFY, CORP19=

CAL).

In the example below, the fiscal period for the chart is set to the State Fiscal Year, i.e. Uune 30,

20XX.

oScatter.FiscalPeriod = "sfy"

4.8.15 Chart Color

The background color for the chart can be set using the “chartcolor” parameter. In the example

below, the chart color is set to “honey dew”. There is a list of all recognized chart colors at http://

web.njit.edu/~walsh/rgb.html. The color name is not case sensitive and any embedded spaces

are ignored.

oScatter.ChartColor = "Honey Dew"

Page 29: Trend Line  Guide

Trend Lines with Audit Commander

4.8.16 Plot Position

The chart is logically divided into two parts. The chart as a whole and the data plot, which

occupies just a portion of the chart. Generally, room must be left at both the top and bottom to

show chart titles, axis labels, etc. Also, on the left, room must be provided for the numeric

amounts. The plot area is specified as a percentage of the entire chart width and chart height

using the following parameters (all of which are specified as percentages)

Parameter Default value DescriptionPlotUCX .10 Plot Upper Corner X value is the percentage of

the chart reserved on the left, in this example

10%PlotUCY .15 Plot Upper Corner Y value is the percentage of

the chart reserved at the top, in this example

15%PlotLCX .75 Plot Lower Corner X value is the percentage of

the chart width reserved for the plot, in this case

75%PlotLCY .75 Plot Lower Corner Y Value is the percentage of

the chart height reserved for the plot, in this case

75%

oScatter.PlotUCY = 0.1

oScatter.PlotUCX = 0.15

oScatter.PlotLCY = 0.65

oScatter.PlotLCX = 0.75

4.8.17 TrendLineColor

The color of the trendline can be set using the “trendlinecolor” parameter. In the example below,

the trend line color is set to “orange”. The color name is not case sensitive and any embedded

spaces are ignored.

Audit Commander User Guide Copyright 2009 Page 29 of 40

Page 30: Trend Line  Guide

Trend Lines with Audit Commander

oScatter.TrendLineColor = "orange"

4.8.18 Connect Line Color

The color of the line connecting the scatter point values can be set using the “connectlinecolor”

parameter. In the example below, the connect line color is set to “dark green”. The color name

is not case sensitive and any embedded spaces are ignored.

oScatter.ConnectLineColor = "dark green"

4.8.19 Stat Box Color

The color of the text box containing the trend line statistics such as slope, intercept, etc. can be

set using the “statboxcolor” parameter. In the example below, the statistics box is colored a light

yellow..

oScatter.StatBoxColor = "light yellow"

Page 31: Trend Line  Guide

Trend Lines with Audit Commander

4.8.20 WallPaper

The background graphic used for the chart, the wallpaper, may be set to a specific file name

which is of graphic format. Valid formats include .png, .jpg, .gif and .jpeg. The wall paper can be

set using the “wallpaper” parameter. If the wall paper is not large enough to cover the entire

chart, then it will be replicated (“tiled”). In the example below, the wallpaper is set to the file

“bg.png”

oScatter.WallPaper = "c:\test\scatter\image\bg.png"

4.8.21 X-Axis Colors

The colors used along the bottom of the chart can be controlled using various parameters. Each

parameter is the name of a color. The color name is not case sensitive and embedded blanks

are ignored. There are three parameters as follows:

Parameter DescriptionxAxisBaseColor The color used for the base line of the x-axisxAxislabelColor The color used for the labels on the x-axisxAxisTitleColor The color used for the title of the x-axis

An example is shown below where the labels are colored red

oScatter.xAxisLabelColor = "red"

Audit Commander User Guide Copyright 2009 Page 31 of 40

Page 32: Trend Line  Guide

Trend Lines with Audit Commander

4.8.22 Text Box

The placement of the text box which contains the trend line statistics can be controlled using two

parameters:

textboxX – indicates the horizontal position and ranges in value from 1 to the chart width

textboxY – indicate the horizontal position and ranges in value from 1 to the chart height.

An example of the textbox parameter to place the text box in lower right corner of the chart is

shown below. To place the text box towards the upper left corner, both the X and Y values would

be smaller.:

oScatter.TextBoxX = 270

oScatter.TextBoxY = 245

4.9 Click the “Run” button

1. To run the macro, click inside the macro and then either click the “run” icon on the tool

bar, or else select the menu item “Run” or press Control-R

Page 33: Trend Line  Guide

Trend Lines with Audit Commander

4.10 Data Used

The data used for this example can be downloaded from

http://ezrstats.com/online/newinno/POExt.xls . The same data (in Access 2002 format) is

contained at http://ezrstats.com/online/newinno/POExt.mdb.

4.11 Summary

Trend line analysis can be readily performed using Excel macros with the ability to “drill down” to

the data of interest and easily produce visually appealing charts of the results. These charts

help visualize the trends in the underlying data. There are various advantages and

disadvantages of using trend lines for analytical review.

4.12 Advantages

• Auditor does not necessarily need special knowledge to identify exceptional conditions• Possible to process fairly large data volumes easily• Ability to “drill down”, when needed• Can focus the audit on “critical” or “high risk” areas

4.13 Disadvantages

• Requires some training in data interpretation and query techniques• Not applicable in all instances• Can result in “false positives”

Audit Commander User Guide Copyright 2009 Page 33 of 40

Page 34: Trend Line  Guide

Trend Lines with Audit Commander

Appendix

The macro code shown below was used to produce the charts in this monograph. This code

could be copied and pasted into an Excel macro and run. Note that lines of code beginning with

an apostrophe are comments and are not run. The code is also included in the work book which

can be downloaded at http://ezrstats.com/online/newinno/Trend.zip.

Option Explicit

'

' run the various types of trend lines

'

Const sBasedir = "c:\test\scatter\chart\"

Sub tsA()

Dim sInfile As String

Dim sChartfile As String

Dim sMsg As String

sInfile = "c:\temp\mdb\poext.mdb"

Dim oScatter As New cScatter

oScatter.Infile = sInfile

oScatter.ChartFile = sBasedir & "t-fig1.png"

oScatter.AmtCol = "Invamount"

oScatter.Datecol = "invdate"

oScatter.Table = "poext"

'oScatter.Where = "vendor_number = '105313'"

'oScatter.Where = "invdate > #6-30-2003# "

'oScatter.Where = "vendor_number = '105313' "

oScatter.Outfile = sBasedir & "t-out10.txt"

'oScatter.TempFile = sBaseDir & "t-temp.txt"

oScatter.Title = "Invoice Counts by Quarter"

'oScatter.AggregateData = "min"

'oScatter.AggregateData = "max"

Page 35: Trend Line  Guide

Trend Lines with Audit Commander

'oScatter.AggregateData = "average"

oScatter.AggregateData = "count"

'oScatter.AggregateData = "stdev"

'oScatter.AggregateData = "range"

oScatter.XAxis = "Invoice Date"

oScatter.StartDate = "5/13/2002"

oScatter.EndDate = "12/31/2005"

oScatter.ChartType = "trend"

oScatter.Data = "Invoices"

oScatter.FiscalPeriod = "SFY"

oScatter.ChartColor = "honey dew"

oScatter.PlotUCY = 0.1

oScatter.PlotUCX = 0.15

oScatter.PlotLCY = 0.65

oScatter.PlotLCX = 0.75

oScatter.TrendLineColor = "orange"

oScatter.ConnectLineColor = "dark green"

oScatter.StatBoxColor = "light yellow"

'oScatter.WallPaper = "c:\test\scatter\image\bg.png"

'oScatter.WallPaper = "c:\test\scatter\image\raleigh-capital-

soft.jpg"

oScatter.xAxisBaseColor = "dark blue"

oScatter.xAxisLabelColor = "dark green"

oScatter.xAxisTitleColor = "dark brown"

oScatter.TextBoxX = 270

oScatter.TextBoxY = 245

'

' plot1 - all records, counts, SFY

'

Call oScatter.RunSql

If oScatter.Err = False Then

Call oScatter.Plot

sMsg = "Plot results: " & vbCrLf

sMsg = sMsg & "Slope: " & Format(oScatter.Slope, "###,###,###.00") &

vbCrLf

Audit Commander User Guide Copyright 2009 Page 35 of 40

Page 36: Trend Line  Guide

Trend Lines with Audit Commander

sMsg = sMsg & "Intercept: " & Format(oScatter.Intercept,

"###,###,###.00") & vbCrLf

sMsg = sMsg & "Corr: " & Format(oScatter.Corr, "###,###,###.00") &

vbCrLf

'MsgBox sMsg

End If

' plot totals by quarter

'oScatter.Where = "vendor_number = '105436'"

oScatter.Outfile = sBasedir & "t-fig2.txt"

oScatter.Title = "Invoice Totals by Quarter"

oScatter.ChartFile = sBasedir & "t-fig2.png"

oScatter.AggregateData = "sum"

oScatter.TextBoxX = 230

oScatter.TextBoxY = 245

Call oScatter.RunSql

If oScatter.Err = False Then

Call oScatter.Plot

End If

' max by quarter

oScatter.AggregateData = "max"

oScatter.Outfile = sBasedir & "t-fig3.txt"

oScatter.Title = "Invoice Maximum by Quarter"

oScatter.ChartFile = sBasedir & "t-fig3.png"

Call oScatter.RunSql

If oScatter.Err = False Then

Call oScatter.Plot

End If

' 105313 - count by quarter

oScatter.AggregateData = "count"

oScatter.Where = "vendor_number = '105313'"

oScatter.Outfile = sBasedir & "t-fig4.txt"

oScatter.Title = "Vendor 105313"

oScatter.ChartFile = sBasedir & "t-fig4.png"

oScatter.WallPaper = "c:\test\scatter\image\bg.png"

oScatter.TextBoxX = 290

Page 37: Trend Line  Guide

Trend Lines with Audit Commander

oScatter.TextBoxY = 245

Call oScatter.RunSql

If oScatter.Err = False Then

Call oScatter.Plot

End If

' 105436 - count by quarter

oScatter.Where = "vendor_number = '105436'"

oScatter.Outfile = sBasedir & "t-fig5.txt"

oScatter.Title = "Vendor 105436"

oScatter.ChartFile = sBasedir & "t-fig5.png"

oScatter.AggregateData = "count"

oScatter.TextBoxX = 300

oScatter.TextBoxY = 265

Call oScatter.RunSql

If oScatter.Err = False Then

Call oScatter.Plot

End If

' 105436 - totals by quarter

oScatter.Where = "vendor_number = '105436'"

oScatter.Outfile = sBasedir & "t-fig6.txt"

oScatter.Title = "Vendor 105436"

oScatter.ChartFile = sBasedir & "t-fig6.png"

oScatter.AggregateData = "sum"

oScatter.WallPaper = "c:\test\scatter\image\marble2.jpg"

oScatter.TextBoxX = 300

oScatter.TextBoxY = 265

oScatter.FiscalPeriod = "sfy"

Call oScatter.RunSql

If oScatter.Err = False Then

Call oScatter.Plot

End If

' 105436 - totals by month (two years)

oScatter.Where = "vendor_number = '105436'"

oScatter.Outfile = sBasedir & "t-fig7.txt"

Audit Commander User Guide Copyright 2009 Page 37 of 40

Page 38: Trend Line  Guide

Trend Lines with Audit Commander

oScatter.Title = "105436 - Two years ended 6/30/05"

oScatter.ChartFile = sBasedir & "t-fig7.png"

oScatter.AggregateData = "sum"

oScatter.FiscalPeriod = "mon"

oScatter.StartDate = "7/1/2003"

oScatter.EndDate = "6/30/2005"

oScatter.TextBoxX = 270

oScatter.TextBoxY = 85

Call oScatter.RunSql

If oScatter.Err = False Then

Call oScatter.Plot

End If

' 105436 - federal fiscal year (two years)

oScatter.Where = "vendor_number = '105436'"

oScatter.Outfile = sBasedir & "t-fig8.txt"

oScatter.Title = "105436 - Two years ended 6/30/05"

oScatter.ChartFile = sBasedir & "t-fig8.png"

oScatter.AggregateData = "sum"

oScatter.FiscalPeriod = "ffy"

oScatter.StartDate = "7/1/2003"

oScatter.EndDate = "6/30/2005"

oScatter.TextBoxX = 80

oScatter.TextBoxY = 115

Call oScatter.RunSql

If oScatter.Err = False Then

Call oScatter.Plot

End If

' 12417 - std dev by month (two years)

oScatter.Where = "vendor_number = '12417'"

oScatter.Outfile = sBasedir & "t-fig9.txt"

oScatter.Title = "12417 - Two years ended 6/30/05"

oScatter.ChartFile = sBasedir & "t-fig9.png"

oScatter.AggregateData = "stdev"

oScatter.FiscalPeriod = "mon"

Page 39: Trend Line  Guide

Trend Lines with Audit Commander

oScatter.StartDate = "7/1/2003"

oScatter.EndDate = "6/30/2005"

oScatter.TextBoxX = 80

oScatter.TextBoxY = 245

Call oScatter.RunSql

If oScatter.Err = False Then

Call oScatter.Plot

End If

Set oScatter = Nothing

End Sub

Audit Commander User Guide Copyright 2009 Page 39 of 40

Page 40: Trend Line  Guide

Trend Lines with Audit Commander

Comment form

Please send any comments, suggestions or items identified as errors to:

[email protected]

Although I am not able to respond to all such comments and suggestions, I will try to do so as feasible. Registered users of Audit Commander will be notified as revised versions of the manual are released.


Recommended