Printer Friendly
The Free Library
14,558,602 articles and books
Member login
User name  
Password 
 
Join us Forgot password?

The power of arrays: the Excel tool that performs multiple functions in a single step.


One of the most powerful features of Excel is the array--a formula designed to act simultaneously on sets of two or more values in order to calculate other values. Yet, because arrays appear to be forbidding, few CPAs use them. This article is designed to dispel arrays' bad reputation and demonstrate how they can speed and simplify your work while making it less prone to errors. So get ready to overcome your bias against arrays.

We'll begin with the most basic array formula, and as we move--step by step--to more complicated ones, you'll see how powerful arrays can get. To make it easier for you to follow along, download an Excel file from www.aicpa.org/download/pubs/jofa/mar2007/goldwater.xls. The file contains two versions of each worksheet. One worksheet in each set has blank cells in which you can practice entering the arrays and other formulas mentioned in this article, while the other has all the cells already completed.

AVENGE a·venge  
tr.v. a·venged, a·veng·ing, a·veng·es
1. To inflict a punishment or penalty in return for; revenge: avenge a murder.

2.
 IT

Accountants often need to tightly summarize sum·ma·rize  
intr. & tr.v. sum·ma·rized, sum·ma·riz·ing, sum·ma·riz·es
To make a summary or make a summary of.



sum
 data. Exhibit 1 uses a one-dimensional array formula on payroll information to calculate the average pay of each employee and the global average of all employees. (In your downloaded file, see the Average It worksheet).

[ILLUSTRATION OMITTED]

Here's how we did it:

To calculate the average per employee, select the range G3:G7 and type this formula:

=(B3:B7+C3:C7+D3:Dg+E3:E7+F3:F7)/5

Then press Ctrl+Shift+Enter, which does two things: It automatically places curly curl·y  
adj. curl·i·er, curl·i·est
1. Having curls.

2. Having the tendency to curl.

3. Having a wavy grain: curly maple wood.
 brackets--{}--around the formula, labeling it an array formula, and simultaneously triggers the array calculation. The array formula now exists in G3 to G7 and cannot be changed except by rewriting re·write  
v. re·wrote , re·writ·ten , re·writ·ing, re·writes

v.tr.
1. To write again, especially in a different or improved form; revise.

2.
 the entire formula.

To calculate the average pay per month, select the range B8:G8 and type in this formula:

=(BB:Ga+B4:G4+B5:G5+B6:G6+B7:G7)/5

Then press Ctrl+Shift+Enter. The global average for all employees is now in cell G8.

RANK IT

Creating two-dimensional arrays is slightly more challenging. Consider again the payroll data of Exhibit 1. This time we want to rank the paychecks by size. To do that, copy the list of names (as shown in the lower half of Exhibit 2) and type this formula:

=RAN K(B3:FT, B3:FT)

[ILLUSTRATION OMITTED]

Press Ctrl+Shift+Enter, and presto, the data are ranked--a task that would be far more difficult without arrays.

ANALYZE IT

Arrays also are useful when performing analyses that impose conditions upon mathematical operations Noun 1. mathematical operation - (mathematics) calculation by mathematical methods; "the problems at the end of the chapter demonstrated the mathematical processes involved in the derivation"; "they were learning the basic operations of arithmetic" . For example, say you have a spreadsheet loaded with sales data and you want to see various subsets of the data based on ranges of products' prices and quantity (see Exhibit 3). For this calculation we will use a single-cell array. (See the worksheet Single Cell in your downloaded file.)

[ILLUSTRATION OMITTED]

If we want to know the sum of range B3:B7 by range C3:C7, typically we could create D3:D7 and place the sum in cell D8. However, an array formula in D9 would do the job in one pass:{=SUM(B3:B7*C3:C7)}

That simple formula extracts all the information from the underlying cells without the usual sum formulas in D3:D8. The grayed area at the bottom of Exhibit 3 (D9:D13) contains various array formulas to compute To perform mathematical operations or general computer processing. For an explanation of "The 3 C's," or how the computer processes data, see computer.  numerous values of interest to CPAs. Table 1 lists many of the typical ways CPAs are called upon to manipulate such data and the array formulas that perform each of those calculations.

Advisory: Often CPAs need to know, and perhaps to explain to clients or executives who are not handy in Excel, how certain spreadsheet numbers are derived (see screenshot See screen shot.  at right). You can display this information easily by clicking on Tools, Formula Auditing, Evaluate Formula. This allows you to step through the calculations, first seeing cell references and then the numbers those references represent.

CALCULATE THE CONSTANTS

Arrays often need to import constants, including useful explanatory ex·plan·a·to·ry  
adj.
Serving or intended to explain: an explanatory paragraph.



ex·plan
 information such as dates, names and numbers. This comes up, for example, when you need to include transaction fees, such as sales taxes sales tax, levy on the sale of goods or services, generally calculated as a percentage of the selling price, and sometimes called a purchase tax. It is usually collected in the form of an extra charge by the retailer, who remits the tax to the government.  and shipping charges, in formulas. Exhibit 4 shows invoices both before the application of a 4% sales tax and a 1% shipping fee (column D) and after (column G). See the downloaded file's Single Cell worksheet.

[ILLUSTRATION OMITTED]

This kind of array has to be created and then recalled by way of a drop-down menu See pull-down menu.

drop-down menu - pull-down menu
, which is evoked e·voke  
tr.v. e·voked, e·vok·ing, e·vokes
1. To summon or call forth: actions that evoked our mistrust.

2.
 by clicking on Insert, Name, Define (see Exhibit 5). Under Names in workbook work·book  
n.
1. A booklet containing problems and exercises that a student may work directly on the pages.

2. A manual containing operating instructions, as for an appliance or machine.

3.
, add the designation of a name such as Standard-Charges, and in the Refers to field, add the specification of the percentage rates, such as = {0.04,0.01}. Both of these values could have been stored in separate cells on the spreadsheet. But often these values (constants) should be hidden or made inaccessible inaccessible Surgery adjective Unreachable; referring to a lesion that unmanageable by standard surgical techniques–eg, lesions deep in the brain or adjacent to vital structures–ie, not accessible. See Accessible.  so the employees cannot easily change them.

[ILLUSTRATION OMITTED]

Place the formula in the affected cells (in this case E3:E7 and F3:F7) that recall the percentage rates and apply them to the base amounts. For example, the sales taxes require this formula to be created as an array: {=D3:D7*INDEX(StandardCharges,1)}

The shipping charge array requires selecting the second value from StandardCharges: {=D3:DT*INDEX(StandardCharges,2)}

Let's look at three typical calculations CPAs face. For each, refer to Exhibit 6 and your downloaded worksheet Calculate Constant. Once again, use the Evaluate Formula tool to observe what Excel is doing for each of the following examples.

[ILLUSTRATION OMITTED]

SUMMING BASED ON A CONDITION

When you need to sum values based on one or more conditions, the array formula (in D9) is:

=SUM(IF((D3:D7>=1000)*(D3:DT<1700),D3:D7))

This formula returns the sum of all cells in the range D3:D7 where the value is greater than or equal to 1,000 and less than 1,700. You can include more conditions in the array formula if necessary.

SUMMING THE n LARGEST VALUES IN A RANGE

Cell D10 contains this formula:

=SUM(LARGE(D3:D7,ROW(INDIRECT("1:2"))))

This formula returns the sum of the two largest values in the range D3:D7. LARGE is an Excel function that will be evaluated twice, each time with a different second argument (that is, 1, 2). Also, if you wish to sum the n smallest values in a range, use the Excel SMALL function instead of the LARGE function.

COMPUTING computing - computer  AN AVERAGE THAT EXCLUDES ZEROS

Often the use of averaging commands is distorted by the presence of zeros in the data. Zero may indicate that the transaction is a different type, and that the calculation is not relevant. In many situations we wish to ignore zero values when determining an average. In D11 (Exhibit 6) the array formula =AVERAGE(IF(D3:D7[??]0,D3:D7)) averages all nonzero non·ze·ro  
adj.
Not equal to zero.



nonzero  

Not equal to zero.
 values in the range D3:D7. If you had used the Excel function =AVERAGE(D3:D7), you would have received the value 1,133.07 rather than 1,416.34.

COUNTING THE NUMBER OF DIFFERENCES IN TWO RANGES

Arrays are exceptionally helpful in ascertaining difference conditions that might have significance. That's especially true when performing internal controls, where consistency and agreement are essential. In Exhibit 7, cell E13 contains an array formula that compares corresponding values in two ranges (D3:D11 and E3:E11) and determines the number of differences that are greater than a specific value. The specific value is in 113 ($2.00); think of this as a materiality MATERIALITY. That which is important; that which is not merely of form but of substance.
     2. When a bill for discovery has been filed, for example, the defendant must answer every material fact which is charged in the bill, and the test in these cases seems to
 threshold on the discrepancy DISCREPANCY. A difference between one thing and another, between one writing and another; a variance. (q.v.)
     2. Discrepancies are material and immaterial.
, to separate out those that are trivial TRIVIAL. Of small importance. It is a rule in equity that a demurrer will lie to a bill on the ground of the triviality of the matter in dispute, as being below the dignity of the court. 4 Bouv. Inst. n. 4237. See Hopk. R. 112; 4 John. Ch. 183; 4 Paige, 364.  or caused by predictable events. If there are no differences between the two ranges, the formula will return 0. When entering the data for this formula, both ranges must be the same size. (Refer to the downloaded file's Differences worksheet.)

[ILLUSTRATION OMITTED]

IDENTIFY THE CELLS

The previous array formula returned the number of differences, but we also may want an itemized listing of those differences. To do that in the range F15:F23 enter this array formula:

=LARGE($E$3:$E$11--$D$3:$D$11,ROW(INDIRECT("1:"&$E$13)))

The formula will return the six cells (see cell E13) that are of interest to us because their hourly rate increased by more than $2. To list in ascending ascending /as·cend·ing/ (ah-send´ing) having an upward course.

ascending

progressing to higher levels, usually used in reference to the nervous system.
 order the six employees whose hourly rate has increased by more than $2 per hour, enter the following formula in E15 and copy it into the range E16:E23:

=INDEX($B$3:$B$11,MATCH(F15,($E$3:$E$11)-($D$3:$D$11),0))

RETURNING THE LOCATION OF THE MAXIMUM VALUE IN A RANGE

To return the row number of the maximum hourly rate in the range E3:E11, enter this formula in F26:

=MIN Min (mĭn).

1 Chief river of Fujian prov., SE China, c.350 mi (560 km) long, rising in Wuyi shan and flowing SE to the South China Sea near Fuzhou; it receives several tributaries near Nanping.
(IF(E3:E11=MAX(E3:E11),ROW(E3:E11),""))

It would return the value 5. To return the address of the maximum value, use this array formula in G26:

=ADDRESS(MIN(IF(E3:E11=MAX(E3:E11),ROW(E3:E11),"")), COLUMN(E3:E11))

The value $E$5 will be returned. Obviously this task can be accomplished by eyeballing the data, but when you're dealing with hundreds of employees, Excel can do the job more effectively.

DETERMINING WHETHER A RANGE CONTAINS VALID VALUES

Many times we need to know whether the values in one range are contained in another. This could be used to uncover fraud based on a "padded" payroll, for example. (Refer to the downloaded file's Padded Payroll worksheet.) We could check for that by determining whether every employee receiving a check was also in the master list of employee names. Exhibit 8 demonstrates four array formulas that could do the job--that is, compare payroll names against a master list.

[ILLUSTRATION OMITTED]

Start by placing this formula in J2:

=ISNA Isna (ĭs`nə) or Esna (ĕs`–), town (1986 pop. 43,055), central Egypt, on the Nile River. It is the center for an agricultural area that is irrigated by the Nile. (MATCH(TRUE,ISNA(MATCH($B$2:$B$12,$A$2:$A$10, o)),o))

It will return either TRUE or FALSE. In this case it returns FALSE because there are names in the range B2:B12 receiving payroll checks that are not in the range A2:A10 (the master list of employee names).

Then, in J3 enter this formula:

=SUM(1*ISNA(MATCH($B$2:$B$12,$A$2:$A$10,0)))

It returns the value 4--the number of names receiving a payroll check that are not in the master employee list.

Next, to discover who these people are, enter this formula in the range C2:C12:

=SMALL(IF(ISNA(MATCH($B$2:$B$12,$A$2:$A$10,0)), ROW($B$2:$B$12),""),ROW(IN DIRECT("1:"&$J$3)))

The formula returns the array of row numbers of concern.

And then in D2:D12 is the formula:

=INDIRECT(ADDRESS(C2,2))

It returns the names on the payroll checks.

As you can see, CPAs can use array formulas in many ways. The formulas do complex jobs in step-saving ways and are able to cull cull

the act of culling. Called also cast.
 material that would otherwise consume long hours of searching.

Key to Instructions

To help readers follow the instructions in this article, we use two different typefaces This is a list of typefaces. Serif
Here you can find a graphical version of this table.
  • Aldus
  • Antiqua
  • Aster
  • Baskerville
  • Bell (Monotype) Didone classification serif type deisgned by Richard Austin, 1788
  • Bembo
  • Benguiat
: Boldface See boldface font.  type is used to identify the names of functions, menu items, agendas and URLs. Sans serif Short horizontal lines added to the tops and bottoms of traditional typefaces, such as Times Roman. Contrast with sans-serif.

 type shows the names of files and the names of commands and instructions that users should type into the computer.

Paul Goldwater, Ph.D., is an associate professor of accounting at the University of Central Florida “UCF” redirects here. For other uses, see UCF (disambiguation).
UCF is a member institution of the State University System of Florida. UCF was founded in 1963 as Florida Technological University with the goal of providing highly trained personnel to support the Kennedy
 in Orlando, Fla. Timothy Fogarty, CPA (Computer Press Association, Landing, NJ) An earlier membership organization founded in 1983 that promoted excellence in computer journalism. Its annual awards honored outstanding examples in print, broadcast and electronic media. The CPA disbanded in 2000. , Ph.D., is an associate dean and a professor of accounting at Case Western Reserve University in Cleveland. Their e-mail addresses See Internet address.

e-mail address - electronic mail address
 are paul.go/dwater@bus.ucf.edu and timothy.fogarty@case.edu, respectively.
Table 1

Accounting
question of
interest             Cell   Formula

Sum (using arrays)   D9     {=SUM(B3:B7*C3:C7)}

Sum (if greater      D10    {=SUM((C3:C7>AVERAGE(C3:C7))*B3:B7*C3:C7)}
than the average
price)

Sum (if greater      D11    {=SUM((B3:B7>AVERAGE(B3:B7))*B3:B7*C3:C7)}
than the average
quantity)

Sum (if greater      D12    {=SUM((C3:C7>AVERAGE(C3:C7))*B3:B7*(B3:B7>
than the average            AVERAGE(B3:B7))*C3:C7)}
price and greater
than the average
quantity)

Sum (if greater      D13    {=SUM(((C3:C7>AVERAGE(C3:C7))+(B3:B7>
than the average            AVERAGE(B3:B7))>0)*B3:B7*C3:C7)}
price or greater
than the average
quantity)
COPYRIGHT 2007 American Institute of CPA's
No portion of this article can be reproduced without the express written permission from the copyright holder.
Copyright 2007, Gale Group. All rights reserved. Gale Group is a Thomson Corporation Company.

 Reader Opinion

Title:

Comment:



 

Article Details
Printer friendly Cite/link Email Feedback
Author:Fogarty, Timothy
Publication:Journal of Accountancy
Date:Mar 1, 2007
Words:2047
Previous Article:Internal control guidance: not just a small matter.
Next Article:Choose the right health care account: stay well - and well-financed - with an array of savings options.
Topics:



Related Articles
A spreadsheet update: the battle of the spreadsheets intensifies.
Electronic business tool. (spreadsheet software) (includes an article on personal information management systems) (Buyers Guide)
Spreadsheets: faster, smarter.
The power of spreadsheets. (software programs)
Add perspective to spreadsheets.(information analysis by CPAs using spreadsheet software)
Spreadsheet, meet database - database, meet spreadsheet.
Hey, what if ...?(financial software)
Constructing analysis of variance (ANOVA).
Prepare data for Excel: make information spreadsheet-readable.
Double-teaming in Excel: spreadsheets now can solve tougher calculations.

Terms of use | Copyright © 2009 Farlex, Inc. | Feedback | For webmasters | Submit articles