automating account reconciliation in excel - vba

I have a spread sheet with three columns. the first column contains names of people. the second column contains dates. the third column contains amounts received and invoices paid for the date.
eg:
Name date amount
abc 1-jan-2012 2000 usd
abc 2-jan-2012 (1500) usd
abc 3-jan-2012 2000 usd
abc 3-jan-2012 2000 usd
abc 3-jan-2012 (3500) usd
i am trying to offset the invoices (positive values) against payments (negative value) received. if i use a lifo application then the net_value for the first entry will be 500 USD. the net value for the second entry will be zero.
can anyone suggest a way of automating this exercise. i have written an if statement but the condition does not hold when the payments are more than the invoices (a case of advances being received by the client)
thanks in advance.
this is how the final table will look like
NAME DATE AMOUNT NET VALUE
abc 1-Jan-12 (4,910.00) (4,910.00)
abc 2-Jan-12 3,674.00 (26.00)
abc 16-Jan-12 1,777.00 -
abc 17-Jan-12 (5,477.00) -
abc 22-Mar-12 258.00 258.00
abc 31-Mar-12 5,502.00 1,465.00
abc 7-May-12 3,986.00 -
abc 20-May-12 5,238.00 -
abc 23-May-12 (6,861.00) -
abc 4-Jul-12 (6,400.00) -
abc 9-Aug-12 2,238.00 2,238.00
abc 21-Aug-12 4,855.00 2,456.00
abc 26-Aug-12 (2,399.00) -
abc 9-Sep-12 3,938.00 3,938.00
sorry guys for the confusion...

Do you want to balance for each invoice? If so you are going to want to have a seperate table with all of your invoices and the total/remaining balances can then be calculated for each invoice name/id.
I would probably just use a pivot table that I would refresh on workbook_change:
At least that is how I would do it for a small scale excel reconciliation project. Hope it helps. Good Luck.
Another way you could do it - To create a list of unique invoices you can use this array formula entered with ctrl+shift+enter:
=IFERROR(INDEX($A$2:$A$20, MATCH(0, COUNTIF($E$1:E1, $A$2:$A$20), 0)),"")
Then you can simply do a SUMIF on each invoice ID:
=SUMIF($A$2:$A$22,E2,$C$2:$C$22)

assuming you have the values listed as actual currency amounts, and not the type of text in your example, you can use SUMIF to keep a running total of the account.
in D2:
=SUMIF($A$2:A2,A2,$C$2:C2)
and copy that down. it will show a running total for the status of the account, also keeps note of the items relating to the name in column A, and not for all names.
for your example, this is the result:
Name date amount Running Total
abc 1-Jan-12 $2,000 2000
abc 2-Jan-12 ($1,500) 500
abc 3-Jan-12 $2,000 2500
abc 3-Jan-12 $2,000 4500
abc 3-Jan-12 ($3,500) 1000
Reversed format for a LIFO table - you put the first formula at the last cell (D6 in the example)
=SUMIF(A6:$A$6,A6,C6:$C$6)
and copying it upwards, giving a result that looks like this:
Name date amount Running Total
abc 3-Jan-12 ($3,500) 1000
abc 3-Jan-12 $2,000 4500
abc 3-Jan-12 $2,000 2500
abc 2-Jan-12 ($1,500) 500
abc 1-Jan-12 $2,000 2000
with the total consisting of the amounts on that line and below.

Related

Make Webi report through the BICS Connection

I'm creating a little complex WebI report. I have the following mock up data
Type Type_C Amt
---- ---- --
1 # $500.00
3 # $1000.00
ABC A $10.00
ABC B $14.00
ABC C $15.00
AB A $10.00
AB B $14.00
DAB D $20.00
DAB A $10.00
DAB B $14.00
BC B $14.00
BC C $15.00
My requirement is to show report like this:
Type_Desc Amount
------- ------
A $10.00
D $20.00
E $30.00
ABC $39.00
AB $24.00
BC $29.00
DAB $44.00
I am not sure I fully understand your requirement, but try this.
I created two very simple queries based on the eFashion universe; Query 1 has City and Quantity Sold while Query 2 has State and Quantity Sold. I am not doing a union or any sort of merging here.
In my screenshot tables on the left are the results from each query. The table on the right is actually two tables. I just removed the table header (uncheck Format Table > General > Show table headers) from the second table and put it directly beneath the first table using relative position (Format Table > Layout > Relative Position). I set the column widths in each table to be the same so they will always line up. I also changed the dimension label to "New Dim".
Does that help?

How to append the preceding rows for the same key for different dates in sql/hive

I have the below table. i tried doing this using join with lag and lead function but its not giving the expected result. I'm just not getting any clue how to implement the solution for this.
name date amount
abc 04/06/2018 100
abc 04/06/2018 200
abc 04/13/2018 300
now the output i needed is below.
name date amount
abc 04/06/2018 100
abc 04/06/2018 200
abc 04/13/2018 100
abc 04/13/2018 200
abc 04/13/2018 300
so here 300 is the new value and 100,200 from 04/06/2018 will also shown for 04/13/2018 as one row per amount. Do we have any way to do this in hive/sql/sparksql. Any help will be greatly appreciated.

Normalize monthly payments

First, sorry for my bad English. I'm trying to normalize a table in a pension system where subscribers are paid monthly. I need to know who has been paid and who has not and how much they've been paid. I believe I'm using SQL Server. Here's an example:
id_subscriber id_receipt year month pay_value payment type_pay
12 1 2016 January 100 80 1
13 1 2016 January 100 100 1
14 1 2016 January 100 100 1
12 2 2016 February 100 100 2
13 2 2016 February 100 80 1
But I'm not happy repeating the year and the month for every single subscriber. It doesn't seem right. Is there a better way to store this data?
EDIT:
The case is as follows: this company has many subscribers who must pay monthly and payment can be in various ways. They produce a single receipt for many customers, and each customer that receipt may be paying one or more installments.
These are my other tables:
tbl_subscriber
id_suscriber(PK) first_name last_name address tel_1 tel_2
12 Juan Perez xxx xxx xxx
13 Pedro Lainez xxx xxx xxx
14 Maria Lopez xxx xxx xxx
tbl_receipt
id_receipt(PK) value elaboration_date deposit_date
1 1,000.00 2015-09-16 2015-09-20
2 890.00 2015-12-01 2015-12-18
tbl_type_paym
id type description
1 bank xxxx
2 ventanilla xxx
This basically seems fine. You could split dates out into a separate table and reference that, but that strikes me as a kind of silly way to do it. I would recommend storing the month as an integer instead of a varchar column though. Besides not storing the same string over and over you can more reasonably do comparisons.
You could also use date values, although that might not be worth the trouble when you don't want greater granularity than the month.

sum crystal report different month

I'm using Crystal Reports 2008. And I have database access 2003 "myclass" with table "Class" an output of like this:
----------
Date Total
12/2015 100
01/2016 115
02/2016 150
03/2016 180
----------
Now, my question how formula for "Previous_Total" the output should be:
----------
Date Total Previous_Total
12/2015 100 0 ----> 0 because no data before
01/2016 115 100 -----> this form total
02/2016 150 215 -----> 100 + 115
03/2016 180 365 -----> 100 + 115 + 150
----------
if i'm use record selection ex sample: {Class.date}>=Date("02/2016") And {Class.date}<=Date("03/2016")
i want to show in the report like this:
----------
Date Total Previous_Total
02/2016 150 215
----------
After trying 3 days, my case is done....
create group Date as "In specified order" then setting to "is in the period " and I'm selecting AllDatesFromToday (Position group is down column Page Header).
create group Total as "in ascending order" (Position group is up column Details).
Hide column details
insert Summary Date as "Maximum"
insert summary Total as "Sum"
drag max total to group Date, drag sum total to group Date
Finally create formula Previous_Total:
Sum ({MyClass.Total}, {MyClass.Date}, "daily")-{MyClass.Total}
Drag formula Previous_Total to group Date.
I try to test... Klik Menu Report, Selection Formulas, Record...
{MyClass.Date}<=date("02/2016")
Save, press F5 to refresh data and DONE...
Thank everybody for reply.... :)

How can I create a tabular report in SQL when the column names are in the database, not the query?

http://www.geocities.com/colinpriley/sql/sqlitepg09.htm has a nice technique for creating a tabular report where the column names for the table can be coded in the query but in my case, the columns should be values from the database. Say I have daily sales figures like:
Transaction Date Rep Product Amount
1 July 1 Bob A12 $10
2 July 2 Bob B24 $12
3 July 2 Ted A12 $25
...
and I want a weekly summary report that shows how much of each product each rep sold:
A12 B24
Bob $10 $12
Ted $25 $0
My column names come from the Product column. Say, any product that has a row in the specified date range should have a column in the report. But other products -- which weren't sold in that time frame -- should not have a column of all 0s. How can I do that? Bonus points if it works in SQLite.
TIA.
http://weblogs.asp.net/wallen/archive/2005/02/18/376150.aspx has a good way to extract columns