sum column until blank cell total in different column - excel

I need a sum of transactions to show up in a specific cell in order to use it to import the invoices.
I have a macro to insert a blank row between differing accounts and now i need a formula to sum that specific accounts transactions and place to total in column N.
Currently I have
=IF(F1="",SUM(F2:INDEX(F2:$F$600,MATCH(TRUE,(F3:$F$600=""),0))),"")
as the formula in N1. I'm using Excel 2007 and I'm not sure if that is the reason the index advise on other posts isn't working.
Any help would be much appreciated.

Use this non array formula in N1 put:
=IF(F1="",SUMIF(B:B,B2,F:F),"")

Related

Excel count Unique ID's between two dates + a distinct count of another column for each ID

I am struggling with an Excel formula. I am trying to count the number of Unique ID's between two dates (I have that formula working), but I also want to count the SignUpRoles for each unique ID that qualified between the two dates. I am using O365.
Here is how I am capturing the UserId counts in K10:14
=SUM(IF(FREQUENCY(IF(Weartime13[RecordDate]>=K5,IF(Weartime13[RecordDate]<=J5,MATCH(Weartime13[UserId],Weartime13[UserId],0))),ROW(Weartime13[UserId])-ROW(A5)+1),1))
Here is the worksheet I am working with: RDS_Report
Screenshot:
RDS Report Screenshot
So what I mean by adding another 'if' is that in L14 (for example) you would have
=SUM(IF(FREQUENCY(IF(Weartime13[RecordDate]>=O5,IF(Weartime13[RecordDate]<=J5,IF(Weartime13[SignUpRole]=L9,MATCH(Weartime13[UserId],Weartime13[UserId],0)))),ROW(Weartime13[UserId])-ROW(A5)+1),1))
and in the next column that would change to M9 and N9:
=SUM(IF(FREQUENCY(IF(Weartime13[RecordDate]>=O5,IF(Weartime13[RecordDate]<=J5,IF(Weartime13[SignUpRole]=M9,MATCH(Weartime13[UserId],Weartime13[UserId],0)))),ROW(Weartime13[UserId])-ROW(A5)+1),1))
=SUM(IF(FREQUENCY(IF(Weartime13[RecordDate]>=O5,IF(Weartime13[RecordDate]<=J5,IF(Weartime13[SignUpRole]=N9,MATCH(Weartime13[UserId],Weartime13[UserId],0)))),ROW(Weartime13[UserId])-ROW(A5)+1),1))
I've filled in the last row:
EDIT
As noted by #JosWoolley, a structured reference would have been preferable to row(A5). I would suggest:
=SUM(IF(FREQUENCY(IF(Weartime13[RecordDate]>=O5,IF(Weartime13[RecordDate]<=J5,IF(Weartime13[SignUpRole]=L9,MATCH(Weartime13[UserId],Weartime13[UserId],0)))),ROW(Weartime13[UserId])-ROW(Weartime13[#Headers])),1))
But what if you want to pull these formulas across so that L9 changes automatically to M9 and N9 but it still references the same table columns? I had to look this one up and the answer is:
=SUM(IF(FREQUENCY(IF(Weartime13[[RecordDate]:[RecordDate]]>=$O5,IF(Weartime13[[RecordDate]:[RecordDate]]<=$J5,IF(Weartime13[[SignUpRole]:[SignUpRole]]=L9,MATCH(Weartime13[[UserId]:[UserId]],Weartime13[[UserId]:[UserId]],0)))),ROW(Weartime13[[UserId]:[UserId]])-ROW(Weartime13[#Headers])),1))
Formula for the last row using count & filter would be
=COUNT(UNIQUE(FILTER(Weartime13[UserId],(Weartime13[RecordDate]<=J5)*(Weartime13[RecordDate]>=O5))))
for the total and
=COUNT(UNIQUE(FILTER(Weartime13[[UserId]:[UserId]],(Weartime13[[RecordDate]:[RecordDate]]<=$J5)*(Weartime13[[RecordDate]:[RecordDate]]>=$O5)*(Weartime13[[SignUpRole]:[SignUpRole]]=L9))))
pulled across for the SignUpRole breakdown, assuming UserId is numeric.
But what if you wanted a single formula that could be pulled both down and across for the whole range of dates and roles? This could be arranged as follows:
=COUNT(UNIQUE(FILTER(Weartime13[UserId],(Weartime13[RecordDate]<=J$5)*(Weartime13[RecordDate]>=INDEX($K$5:$O$5,ROW()-ROW($9:$9))))))
for the total and
=COUNT(UNIQUE(FILTER(Weartime13[[UserId]:[UserId]],(Weartime13[[RecordDate]:[RecordDate]]<=$J$5)*(Weartime13[[RecordDate]:[RecordDate]]>=INDEX($K$5:$O$5,ROW()-ROW($9:$9)))*(Weartime13[[SignUpRole]:[SignUpRole]]=L$9))))
for the role columns.
Is there a simpler way of doing this whole thing? Maybe with pivot tables or perhaps power query, but that would be a separate answer :-)

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.

How do you sum an array of formulas within one Google Sheets cell?

If you have a basic table of values with participants sharing each itemized expense. The cells of the table represent their share of the amount, how do you sum all the per-item totals in one row at the bottom of the table?
I've tried using SUM(ARRAYFORMULA(B2:B5*C2:C5)), which gets close, but I need the divisor to be divided by the count all involved columns. Every time I try mapping the amount over the count of each row, it attempts to count all rows and columns together.
I have a working example on Google Sheets
Use SUMPRODUCT:
=SUMPRODUCT($B$2:$B$5*IFERROR(C2:C5/($C$2:$C$5+$D$2:$D$5+$E$2:$E$5),0))
You can also do it by developing the row totals of the 2d range C2:E5 and calculating the share for each person from there
=SUM($B$2:$B$5*N(+C$2:C$5)/(MMULT(N(+$C$2:$E$5),TRANSPOSE(COLUMN($C$2:$E$5)^0))))
It is an array formula and must be entered with CtrlShiftEnter or in Google Sheets as
=arrayformula(SUM($B$2:$B$5*N(+C$2:C$5)/(MMULT(N(+$C$2:$E$5),TRANSPOSE(COLUMN($C$2:$E$5)^0)))))
Another way of doing it in Excel is using OFFSET and SUBTOTAL, but it doesn't work in Google Sheets
=SUM($B$2:$B$5*N(+C$2:C$5)/SUBTOTAL(9,OFFSET($C$2,ROW(C$2:C$5)-ROW($C$2),0,1,COLUMNS($C$2:$E$5))))

Excel Report - Excel Formulas

I am trying to formulate my data on a report in order to return the sum of items from column C based on the same item on column A and column B. For example:
http://i.stack.imgur.com/FadW7.png (I can't post the image because I don't have 10 reputation yet T.T)
On the above image, User "A" has used a Sum of data for "z1". I need to automatically grab a list of users per zones and sum the data for that user and that zone.
I have elementary experience with Excel (I can add formulas but I do not know what formula to write), any help would be greatly appreciated.
Regards,
You can use SUMIFS:
=SUMIFS($C$1:$C$16,$A$1:$A$16,"a",$B$1:$B$16,"z1")
(COLUMN TO SUM, COLUMN WITH 1ST CRITERIA, 1ST CRITERIA, COLUMN WITH 2ND CRITERIA, 2ND CRITERIA)
or
=SUMIFS($C$1:$C$16,$A$1:$A$16,G1,$B$1:$B$16,G2)
where Cells G1 and G2 are the user and zone respectively.
You'll also need to change the range of the cells in the columns.

Invoice List Running Balance based on date and Account

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" :-)

Resources