Poor Man’s System Conversion

Dated: 06/27/18 Software Used: Excel 365, 2016, 2010

Recently, I was asked to assist with a system conversion. I was given the entire general ledger (G/L) from the old system in MS Excel as well as two worksheets for mapping the property numbers and account numbers to the new system. I’ve put a sample screen shot of the G/L so you can see the formating.

At around 26,000 line items, the lead accountant on the project considered using look up formulas. She couldn’t quite picture how to make that work with the format she had. ultimately the solution used will make use of look up formulas, in particular vlookup. But there is a step missing. The reason we can go right to look up formulas is because the general ledger is unnormalized.

Normalize Normalize Normalize

When they brought me in, I knew right away what we needed to do first. To borrow a term from Database Administration the G/L needs to be normalized. That is, it has to be recast it in a way that each row contains all the needed information for the vlookups. This G/L is grouped by Account Number. In other words, the account number doesn’t repeat for each line. To normalize it we have to put the account number on each row.

This was the plan I came up with:

Normalize the G/L

  • Insert 2 Columns for the new property and account number
  • Use vlookup to look up the new mapping
  • Copy the needed info into a journal entry template
  • Assign transaction numbers to the J/E
  • Upload, post and ensure the T/B matches by period by property (her group handled this)

Code

I could have done the entire solution in VBA. But, time was an issue and this was the most direct approach that occurred to me with one viewing of the file.

This is a simple script to create. But first I’ll insert a column which will hold the account number. Next, I analyzed the structure of the G/L. Note that the lines that begin with a number are the account numbers. While lines that begin with a character are data lines. Using this information let’s build our program.

 

Option Explicit

Sub NormalizeGL()
    Dim startRow As Long
    Dim lastRow As Long
    Dim accountNumber As String
    Dim i As Long
    
    startRow = 7
    lastRow = Range("B1048576").End(xlUp).Row
    
    For i = startRow To lastRow Step 1
        If IsNumeric(Left(Range("B" & i).Value, 1)) Then
            'row is an account number
            accountNumber = Range("B" & i).Value        
        Else
            'row is data line and needs the account number
            Range("A" & i).Value = accountNumber
        
        End If
    
    Next i
        
End Sub

Running that will populate column A with the account numbers for each line. The code is intuitive. First I defined two variables to manage the length of the For loop: startRow and lastRow. The string variable accountNumber’s name is obvious. Last I defined the long variable i as our loop counter.

We assign the lastRow using a useful bit of code. What it does is it goes to the last physical row in that column and then searches upwards for a value. When it finds a cell with a value it assigns that row number to the variable. Many of my solutions use this exact fragment since it’s a very common task.

Next, we enter the For loop where the action happens. We examine the first character of each row. If that character is a number, then we assign the cell’s value to accountNumber. Otherwise we know it is a data row, so we’ll set the cell in column A to the value of accountNumber. The result looks like this:

After that, I sorted the normalized G/L by date and period. Then I removed the subtotals and useless artifacts of the report. Now it was a matter of using some simple vlookups to match the new property/account mapping. I inserted the mapping worksheets into the workbook. The mapping worksheets were simple two column (i.e. old and new) to make the vlookup easier. I’ve put an example of the vlookups below, but they are unremarkable.

=vlookup(B7,Mapping!$A$2:$B$4,2,FALSE)

=vlookup(A7,Mapping!$D$2:$E$3,2,FALSE)

I filled in each row with those formulas. Now each row has all the required information to create the journal entry. Again, for simplicity, I copied and pasted each column into the entry template. The normalized and mapped G/L looked like this:

Transaction Numbers

We’re missing one more piece. The journal entry needs transaction numbers for each group of entries. Normally I’d assigned these based on date. But in Yardi date and period are not related. You can use the same date in several periods. Indeed, this client had done this with audit entries and post period adjustments. We needed to combine the date and period into a unique value, which I call a hash. We can use the hash as a key to lookup a unique transaction number.

First I copied both columns to another worksheet. I used the Advanced Filter to remove the duplicates. If you’re unfamiliar with this:

From the Data menu, Under Sort & Filter click Advanced. It may you about not having header rows but this is unimportant for our task, you can ignore the warning.
Select the Range of dates and periods
Select the destination cells, I picked a column to the right
Check Unique records only
Click OK

You’ll see it created a new list of dates and periods with one line for each combination. In the adjacent column I added a formula to join the two into my hash value

=Concat(D2,E2)
or =CONCATENATE(D2,E2) depending on your version of Excel

then to the column to the right I put my transaction number (i.e. 1,2,3)


I created this hash value in one of the unused columns of the journal entry template. Then used a vlookup to find the transaction number. Since this template needs to upload as a csv file, I pasted the transaction numbers as values and then removed the hash column.

The entry was then uploaded and validated with no errors. This project took me about an hour an a half, but saved them one hundred hours of manual entry. You’ll note that I didn’t create a full VBA solution for this. While it is possible, I felt this was the quickest way with the fewest question marks for accuracy.

Do you want to get started with VBA? Or want to learn what a FOR loop is?

My book, Beginning Microsoft Excel VBA Programming for Accountants has many examples like this to teach you to use Excel to maximize your productivity! It’s available on Amazon, Apple iBooks and other eBook retailers!

Questions or Comments?

Connect with me:

Facebook https://www.facebook.com/DerekHarlanWriter/

Twitter https://twitter.com/tazbirdinvader

Creating a Chart of Accounts from a General Ledger in Microsoft Excel using VBA

Recently I was given the task of extracting a chart of accounts (COA) from a general ledger report. There are many ways I could have done this. Using Auto Filter comes to mind. Being me, I chose to write a small program in Visual Basic for Applications (VBA). In this post I will walk you through the design and code of the program I made.

General Ledger
Design:

First we need to determine the goals for our output or in this case the chart of accounts. I needed a report with:

  • account number
  • account description

In the source file we see that the account number is in Column A and the account descriptions are in Column E. We also see that rows that begin with a number are the rows that have the account number/description. Since that’s all we need we’ll ignore everything else.

With that information we know that our solution will have to do the following:

  • find or determine the first and last rows on the source worksheet
  • examine each row in the source worksheet to see if it starts with a number
  • if it does start with a number then
  •     take the account number and
  •     take the account description and
  •     write them to the destination sheet
  •     lastly increment the row in the destination worksheet

It’s obvious that we need a loop in this case we’ll use a FOR loop to examine each row of the source worksheet. It’s also clear we’ll need an IF statement to determine if the first character of the row is a number or not.

Code:
 
Sub ExtractCOA()
 
    'This program will extract the chart of accounts from a Yardi 7
    'default General Ledger (analytics) report run to Excel 
    'Derek Harlan April 2018 - Licensed in the Public Domain 

    'Setup Object Variables for the worksheets 
    'src will be the Source worksheet 
    Dim src As Worksheet 
    'dest will be the Destination worksheet 
    Dim dest As Worksheet 
    'Setup some counter variables 
    'firstRow / lastRow will be the first and last rows of the Source workbook 
    'nextRow will be the row to write in the Destination workbook 
    'i will be the counter in the For loop 
    Dim startRow as Long 
    Dim lastRow As Long 
    Dim i As Long 
    Dim nextRow As Long 
    'Set the initial values for the variables 
    Set src = Sheets("Report1") 
    Set dest = Sheets("Sheet1") 
    startRow = 6 ' this is easy to determine so I just set it the row number 
   'Find the last row by searching the workbook from the bottom row up 
   'and assign it to the variable 
    lastRow = src.Range("A1048576").End(xlUp).Row 
    i = 0 
    nextRow = 2 'Row 1 will be the headers in the worksheet so Row 2 is where the data starts 
    'We'll loop through each row between the first and last rows of the Source workbook 
    For i = startRow To lastRow Step 1 
       'If the first character of the value of the cell in A and the current row (i) is a number then 
       'that row has the account number and name on it 
        If IsNumeric(Left(src.Range("A" & i).Value, 1)) Then 
            'set the values in the destination worksheet from the values on the 
            'current row of the source worksheet 
            dest.Range("A" & nextRow).Value = _ 
               src.Range("A" & i).Value 
            dest.Range("B" & nextRow).Value = _ 
               src.Range("E" & i).Value 
            'lastly increment the nextRow in the destination worksheet 
             nextRow = nextRow + 1 
        End If 
    Next i 
End Sub 

Running it creates this output –

Chart of Accounts in Excel

With both of the requirements met I can say this was a success!

This project took about 20 minutes, from start to finish. In this instance I’m not sure if I saved any time however should I need to do this again I already have the program ready. When evaluating alternatives think about how often you’ll be asked to do this. It may take time to come up with the initial program but once you have it, you see a colossal increase in productivity!

Do you want to get started with VBA? Or want to learn what a FOR loop is?

Check out my book for more uses of Excel VBA in your daily work:

Beginning Microsoft Excel VBA Programming for Accountants

available on Amazon, Apple iBooks and other eBook retailers!

Questions or comments? Connect with me on

Facebook https://www.facebook.com/DerekHarlanWriter/

Twitter https://twitter.com/tazbirdinvader

Artificial intelligence comes to financial statement audits.

This is the greatest most informed article, assuming today is sometime in early 1993. Sadly terms like artificial intelligence and machine learning have become powerful buzzwords so they’re being used in situations where they are far from appropriate.

One particular flaw is where the author makes a point about difference in file formats, such as PDF docs vs text files. Extracting data from these kind of situations has long since been addressed by non-AI software such as ACL and IDEA.  In fact many Audit functions have been preformed by software for years.

Another example, the author talks about how AI is better at aligning data, this is so vague, an Excel formula can easily show if a PO is related to an Invoice and again  – software in particular Audit software has been doing this for a long time and never under the guise of ML or AI.

Where I do feel it has some value is that he recognizes that

Only human beings, such as the auditor, can tell the true story behind the data.

All in all, I think this is 20 years too late.

Source: Artificial intelligence comes to financial statement audits.

4 Models for Using AI to Make Decisions

The world suddenly starts to look brighter as the larger hand hovers over the 6. 4:30pm you think only 30 minutes until I can go home for the weekend. That dreaded  popup ends your jubilation as you start to read the email from your boss. Was the Fredricks order competed? You wince in anger and some regret as you start to key your reply. “No, I thought the priority was the Johnson order, I’ll take care of the Fredricks order Monday morning – we’re close, it won’t be problem” Moments later your boss replies with a terse “Very well, however this lateness will be noted in your review.” Wishing you could protest, but you know better,  you know there’s no arguing with an AI.

More and more companies are embracing AI workers, not just in task oriented roles, but also in decision making ones. Some companies have gone as far as to implement monitoring systems to ensure compliance with the AI’s directives. HBR’s article discusses several such examples. And shows us a world where data-scientists are our ambassadors to our computerized coworkers.

While this sounds like Skynet it’s not all doom and gloom or shouldn’t be Schrage notes

CEOs should worry less about bringing autonomy to heel than making it a powerful source and force for competitive advantage.

Learning to trust the algorithm takes “humility and faith” two qualities that leaders should have in abundance.

Will you able to trust the machine?

 

Source: 4 Models for Using AI to Make Decisions