Consolidated balance sheet

In corporate financial work, a balance sheet must be prepared for each financial cycle, which is divided into monthly, quarterly, and annual. Quarterly reports can be combined from monthly reports, and annual reports can be combined from quarterly reports. Some large companies have many departments, and each department also has a balance sheet. The balance sheet of the head office can be derived from the merger of various departments. If this kind of merging is performed manually, it is not only cumbersome, but also error-prone. If you use a program to automatically complete this kind of work, it will be both efficient and correct. This article will introduce an example of a balance sheet consolidation code written by esProc SPL. esProc is a professional data calculation engine. The SPL provides complete Excel file reading and writing functions, making it easy to merge balance sheets.

The balance sheet is usually as follows:

..

The red font cells in the table are calculated from the data of other cells. These cells do not need to be considered when merging, only the data of black font cells are merged.

 

1. Combine in different time periods

When merging by time period, the opening number of the consolidated statement is the opening number of the first time period, and the closing number is the closing number of the last time period. For example, when the balance sheets of January, February, and March are used to consolidate the statements of the first quarter, the opening number is the opening number of January, and the closing number is the closing number of March.

SPL code:


A B
1 =file("e:/balance sheet/1 month.xlsx").xlsopen()
2 =file("e: /balance sheet/3month.xlsx").xlsopen()
3 =file("e: /balance sheet/first quarter.xlsx")
4 [C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16, C17, C20, C21, C24, C25, C27, C29, C30, C31, C34, C35, C36, C40 , F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F22, F23, F24, F25, F26, F29, F33, F34, F36, F37, F38 , F39)
5 for A4 = A2.xlscell (A5,1)
6
= A1.xlscell (A5,1; B5)
7 = A3.xlswrite (A1)

A1 Open the balance sheet for January

A2 Open the balance sheet for March

A3 Specify the file name of the consolidated balance sheet

A4 List the cell name to read the ending number

A5-B6 cyclically read the ending number of the cell designated by A4 in the March table and write it into the corresponding cell in the January table

A7 Save the merged A1 to the Excel merge file specified by A3

 

2. Consolidation of different departments

When merging different departments, the opening figures of the consolidated statement are the sum of the opening figures of each department, and the closing figures are also the sum of the closing figures of each department.

SPL code example:


A B C
1 [e:/balance sheet/department 1.xlsx,e:/balance sheet/department 2.xlsx,e:/balance sheet/department 3.xlsx]
2 =file("e:/balance sheet/company summary.xlsx")
3 =A1.(file(~).xlsopen())
4 [B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B20, B21, B24, B25, B27, B29, B30, B31, B34, B35, B36, B40 , C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16, C17, C20, C21, C24, C25, C27, C29, C30, C31, C34, C35, C36, C40 , E5, E6, E7, E8, E9, E10, E11, E12, E13, E14, E15, E16, E17, E18, E22, E23, E24, E25, E26, E29, E33, E34, E36, E37, E38 , E39, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F22, F23, F24, F25, F26, F29, F33, F34, F36, F37 , F38, F39]
5 for A4 >v=0
6
for A3 = B6.xlscell (A5,1)
7

>v+=if(C6==null,0,float(C6))
8
if v==0 >A3(1).xlscell(A5,1;null)
9
else >A3(1).xlscell(A5,1;string(v))
10 = A2.xlswrite (A3 (1))

A1 List the file names of each department’s balance sheet

A2 Specify the file name of the consolidated balance sheet

A3 Open the balance sheet file of each department

A4 List the cell name to read data

A5-C9 Cycle the cells to be read, read the current cell data from each department table (without filling in 0), and accumulate it to the variable v, and write the accumulated v to the corresponding cell of the first department table Medium (empty the cell when v is 0).

A10 Save the first department table with the merged value to the Excel merge file specified by A2


Guess you like

Origin blog.51cto.com/12749034/2551769