Test your Excel IQ: Solution

BY J. CARLTON COLLINS, CPA

Last month I turned the tables and challenged JofA readers to answer another reader’s Excel question, as follows:

Q: I have created an Excel template in which I enter employee information and pension data, and as we enter this data, I want the last row automatically displayed in the ready-to-print formatted report, a rough example of which is pictured below.

 

My problem is that as this list grows longer, I can’t figure out how to automatically reference the last row of data in the ready-to-print, formatted report without editing the formulas to refer to that ever-changing last row.

A: My solution to this problem involved the following three steps:

1. Number the rows containing data. In cell A4, I entered the value 1, and then in cell A5, I entered the formula =IF(ISBLANK(B5)=TRUE,"",1) and copied it downward to number each subsequent row containing data with the next logical row number (as shown below). (The ISBLANK portion of this formula determines whether data exists in the row, and the IF portion dictates when the row should be numbered.)

In effect, these formulas number each row when the adjacent cell in column B contains data; otherwise these formulas return a blank result (no row number).

2. Extract the last row’s data. Next, I created a series of formulas in row 1 (above the data range) using the Vlookup and Max functions. I started by entering the formula =VLOOKUP(MAX($A$3:$A$147),$A$3:$H$147,2) into cell B1, as pictured below.

In effect, this formula calculates the largest value in column A using the Max function (the max value in this example is the value 7), and then uses the Vlookup function (based on the max value) to return the data for the last row containing data (row 7 in this example). Because the largest value in column A will always reflect the last row, this formula will always return the data contained on the last row. I then copied this formula across row 1 (to cells C1 through J1 in this example) and edited each formula slightly to return the corresponding data for each respective column. The effect is to duplicate the last row of the data range on row 1 of the worksheet.

3. Reference the extracted data. Finally, I used simple reference formulas to repeat the data summarized in row 1 in the pension plan summary (e.g., by entering the formula =B1 in cell P9 in the example pictured below).


The total effect is that the last row of data entered in the data range is reflected in the resulting pension plan summary. You can download a working copy of this solution at carltoncollins.com/answer.xlsx. The tricks and methods used herein are fairly simple once you understand them, and they can be used to efficiently summarize many types of data.

MANAGEMENT ACCOUNTING

Developing finance leaders

A good leader recognizes that part of the job is developing the next generation of leaders. Veronica McCann, CGMA, a former division CFO at Commerzbank in Singapore, shares tips on developing future finance leaders.

PROFESSIONAL ISSUES

Belicia Cespedes: A CPA at 17

Through hard work and determination, Belicia Cespedes earned the credential before she was even eligible to vote.

SPONSORED REPORT

How to audit high risk areas

Revenue recognition, internal control over financial reporting, accounting estimates and going concern are areas of audit that have emerged as particularly challenging and complex.