Invoice List Running Balance based on date and Account - excel

I'm using Excel 2010 and have made a UserForm that Displays a complete list of Invoices from Worksheets("InvoiceListIncome") using a ListBox control, the Worksheet has 13 Columns and Thousands of rows, an example image below;
The problem I'm having is the Balance Row Range("InvoiceListIncome_Balance")" displays the balance of each Invoice individual, what I need is a running balance starting from the first invoice Range("InvoiceListIncome_Date") so with each Transaction it Adds up the Current + all previous invoices for that account.
The Macro I'm currently using is;
Range("InvoiceListIncome_Balance").FormulaR1C1 = "=SUM(RC[-1])-SUM(RC[-2])"
which simply subtracts whats Paid in Column F from Item Price in Column G, but I cant seem to figure out how to add all previous balances by date, I can either get it to Sum the complete Range with the Customers account as the criteria or just the activerow.
I have been running circles trying to figure this out for days now, any help would be muchly appreciated, thanks.
Here is an example of what I need;

Assuming you have Account, Price, and Paid in columns A, D, and E, respectively, with your first row of data in row 2, try the following formula in row 2:
=SUMIF($A$2:$A2,$A2,$E$2:$E2)-SUMIF($A$2:$A2,$A2,$D$2:$D2)
Copy the formula down the column. This assumes that your data is sorted in increasing chronological order as you show.
Also, if this formula is working, you have the wrong sign on the 4th row from the bottom of the column that you want????

You want a running total, so you want to incorporate the balance of row (n-1) when calculating the balance for row n.
Based on your 1st picture, make the following changes:
formula in G2: =F2-E2
formula in G3: =G2+F3-E3
copy formula from G3 down to the end of the list; the last value is your current balance
edit
sorry ... I seem to have overlooked the break-on-account condition. Well that makes it even easier as there is only one formula you need all the way down ....
to break on customer (provided the customer column is sorted) you would use the following formula
formula in G2: =IF(A2=A1,G1+F2-E2,F2-E2)
copy formula from G2 down to the end of the list
(if this.account = previous.account then calculate.running.total else create.new.balance)
This will work as long as your first customers' name is <> "Account" :-)

Related

Google Sheets / Excel - Change value based on other cell

Quite a newbie when it comes to more advanced spreadsheet formulas. I am effectively trying to achieve the following on a finance spreadsheet.
I have multiple "accounts" with different values.
I have a sheet for money in and money out.
If account A has been selected in the previous cell, and then a value is added to either the money in or money out columns, I would like the value of the account to reduce or increase.
Hopefully this is enough info! Thanks.
You can use SUMIF. Take a look at this example:
By choosing the entire columns E and F, now whenever you add something below the transaction data, the balance will be automatically updated.
The arguments in SUMIF function are range, criteria and [sum_range] respectively. So in this one, we are summing the values of column F, where the corresponding value in column E is equal to A (which is placed in cell A2).
You can also use Excel Tables as a neater solution.
Use this formula in E3 and copy down.
=SUM(E2,C3,-D3)
E2, in this case, contains text (the column caption) which the SUM() function evaluates to 0. To this, the formula adds the amount in the Money In column and deducts whatever is in the Money Out column. One of these values will usually be zero but the total calculated by the formula will be the current balance.

To find the month corresponding to vnedor name and latest payment

I am having a table for the payments made to different subcontractors and suppliers in different months and against different invoices. I want to get the month in a summary sheet for a particular vendor against the latest invoice. Can anyone give the idea how to get it please?
Consider the following example:
First step would be to sort the data according to the vendor. I have sorted them according to column A.
Use advanced filter to get the unique values in column F to create your summary
in column G use the formula =COUNTIF($A:$A,$F2) to get the number of entries for each invoice.
in column H type the following formula:
=MAX(INDIRECT("C"&ROW(INDEX($A$2:$A$18,MATCH($F2,$A$2:$A$18,0)))&":C"&ROW(INDEX($A$2:$A$18,MATCH($F2,$A$2:$A$18,0)))+SUM(G2)))
The formula works as follows:
Sets the range for MAX using INDIRECT
Uses INDEX and ROW inside the INDIRECT formula to find the first row in the range $A$2:$A$18 that corresponds to the vendor name as a starting point for the MAX formula.
Using the count of the invoice entries in column G you set
the end of MAX formula range.
When you evaluate the formula in cell H2, the end result should be =MAX($C2:$C5) and this is returned to you as a result.
This works because dates are stored as numbers in excel. If there is more than one invoice from the same vendor in the same date it will still work.
To show the month, you could format the cell as MMMM YYYY or nest the formula inside a text formula if the desired output is just a text, something like:
=TEXT(MAX(INDIRECT("C"&ROW(INDEX($A$2:$A$18,MATCH($F2,$A$2:$A$18,0)))&":C"&ROW(INDEX($A$2:$A$18,MATCH($F2,$A$2:$A$18,0)))+SUM(G2))),"MMMM YYYY")
Implementing it in your workbook should be easy, as long as you sort the entire table based on the Vendor name.
I hope this helps.

Key words and sum equations

Sample Page I have a spreadsheet That I am having trouble getting a formula running.
I have a table that has a handful of columns, being brand, description and sales.
I need to get a formula that will automatically find a keyword in column A and B and SUM all the totals to transfer to another worksheet.
Example I have 2 similar products by name, Demo Firm, and Demo Soft. I have them sorted into text to columns to make it easier to search. Demo in the 1st Column, Firm in the 2nd, Sales in the 3rd.
I need to be able to search all of column A and find every word "DEMO", then I need the formula to Search Colum B and Find all the "Firm", finally I need it to sum up the totals of Column 3 of "DEMO FIRM" and place the sum into Column4.
I have tried IFSUM, IFSUMS, and DSUM but I think I am missing one little step.
I hope this makes sense, in my head I know what I want to do, explaining it is difficult.
Thanks for your help. Will keep an eye on my email if further info needed.
I have uploaded an image of what I am needing (SAMPLE PAGE at top of post). The formula that was commented worked for a my small sample. I just need to make sure it will work on an ever changing spreadsheet.
If it is assumed that your data fills rows 2-10, i.e. A2:A10, etc., but obviously this can be changed as needed. As I understand it, you want to sum up all sales into Column D, based on the values in Column A and Column B. You can simply use a SUMIFS formula in Column D, in this case D2 and drag down for all rows, as follows:
=SUMIFS($C$2:$C$10, $A$2:$A$10, A2, $B$2:$B$10, B2)
So if A2 contains DEMO and B2 contains FIRM, then this formula will sum all of the sales totals in Column C where Column A contains DEMO and Column B contains FIRM.

excel - advanced vlookup or other formula?

I have a question regarding excel and I am looking for a formula that can help me transport my data from one sheet to the other. I have some experience with excel, however I am not a pro at it, so I apologize if this is a very trivial question but would also be happy since that would mean it probably has a very trivial answer! Unfortunately I do not have enough reputation points yet to post images, but I will try to explain it as clearly as possible.
Basically I am creating an excel template and the goal is to have 2 sheets in excel.
In the first sheet I have a column with following input in rows A1 - A3: Sales Region,
Country, Account ID's.
Above is the example of column A; from column B --> x; I will put e.g.
Americas, US and as many account numbers as there are in that specific country.
However on the second sheet it gets a bit complicated. My goal is that all the account numbers from sheet 1 irrespective of their sales region and country (which also means irrespective of their column) will automatically be listed on the second sheet.
The second sheet will be organized in the following way:
From column A - C; sales region, country and account ID.; from column D - x financial information for each account.
As a first step I want all the different account ID's from the different columns on the first sheet to be listed under column C (account ID's) on the seconds sheet.
As a second step I want column A - B to be automatically filled out according to account number by accessing the information in which column and thus sales region and country the account is in on sheet one.
I don't think a simple vlookup would do the job, especially for step 1, since I want the account ID's from many different columns and rows in sheet 1 to be listed in just one column....
hope it is clear enough! Would appreciate any help! :) thanks in advance!
The first step take all of column A and copy it to the 2nd sheet on column C.
Select data ribbon and select remove duplicates.
For column A insert vlookup for column C for all the data in 1st sheet
For column B insert vlookup for column B for all the data in 1st sheet
Those value will work well only if an ID has one valid Region and country.
Now just use custom sort to sort it in the way you desire.

INDEX&MATCH excel on rows and return SUMPRODUCT

I needed some help with Excel functions as I am not really sure how to achieve this.
Basically, this picture shows my data structure:
I am aware that I can use Index& Match excel functions together for columns but I am not sure if it is possible use Index&Match together on two row conditions.
Requirement:
I have three products, product A, product B and Product C. I want to be able to quickly calculate the actual revenue and and you can see the data structure in the image above. My top-most row is month. For each month, I have 4 columns, of which 2 need to be calculated should the condition match.
This is the condition. An example, for product A, calculate the total sumproduct(multiples column actual customers x Price Actuals) for yearMonth 201501.
So basically,first, for product A, it would need to find YearMonth 201501, and when it is found, it should find columns Actual Customers and Price Actuals and return the SUMPRODUCT of Actual Customers and Price Actuals.
Is it possible to do this?
I have searched the Internet a bit and I have not found a solution.
Update:I thought I could post the follow-up question in the same thread insted of Cristiano duplicates... For the accepted answer, in the excel formula, how can it be divided by the total amount of "actual customers" for that month?
Simply adding "actual customers" with a slash before IT does not work.
You need a cell where you specify the month you want to look up. Give that cell the name "TheMonth".
You need a cell where you specify the product you want to look up. Give that cell the name "TheProduct".
Then, assuming your screenshot starts in cell A1, you can use
=SUMPRODUCT($B$3:$I$5*($B$1:$I$1=TheMonth)*(($B$2:$I$2="Actual Customers")+($B$2:$I$2="Price - Actuals"))*($A$3:$A$5=TheProduct))
Next time, please post a link to a workbook. It's not much fun typing in the text and numbers from a screenshot in order to verify a formula.
Here is the workbook with the formula in action.

Resources