You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

HOW TO CREATE RUNNING TOTALS BASED ON CATEGORIES

Hi Everyone,

My first question here. It's a little more complex running total situation,

I'd like to create a Running Total column in my TRANSACTION Table based upon CATEGORIES and upon the previous End of Financial Year total located in the TRANSACTION SUMMARY table.

I have attached simplified versions of the tables below.

Regards

Ben



MacBook Pro 13″, macOS 12.4

Posted on Jul 12, 2022 8:12 PM

Reply
Question marked as Top-ranking reply

Posted on Jul 13, 2022 9:46 PM

You can use OFFSET to create a "sort-safe" formula, like this:



No need to wrap the formula with IFERROR. Just put the 0 in the 'if-not-found' parameter for XLOOKUP, as I've done in the formula above. (I had "NF" in the original formula in the previous post.)





SG



Similar questions

11 replies
Question marked as Top-ranking reply

Jul 13, 2022 9:46 PM in response to bzabbia

You can use OFFSET to create a "sort-safe" formula, like this:



No need to wrap the formula with IFERROR. Just put the 0 in the 'if-not-found' parameter for XLOOKUP, as I've done in the formula above. (I had "NF" in the original formula in the previous post.)





SG



Jul 13, 2022 2:44 AM in response to bzabbia

bzabbia wrote:

I'd like to create a Running Total column in my TRANSACTION Table based upon CATEGORIES and upon the previous End of


It's hard to tell from your screenshot what you are trying to do. But from your description, are you trying to do something like this?




Here, it's assumed you have the end of fiscal year in cell B1 of the Transaction Summary table.


Then the formula in F2, filled down would be:


=SUMIFS(E$1:E2,D$1:D2,D2,B$1:B2,">="&Transaction Summary::$B$1)



Keep in mind that a Pivot Table might be a much quicker and easier way to analyze your data (with no formulas!) Click in the data table and from the menu choose Organize > Create Pivot Table > On Current Sheet. See 'Pivot Table Basics' template at File > New in your menu for working examples.


SG


Jul 13, 2022 7:57 PM in response to SGIII

Thanks SG

Sorry if it was unclear from first post, but that's not quite what I need. And I'd rather display the end result in the TRANSACTIONS Table rather than use a pivot table.

I'll try to explain further -

From my attached table screen shots - In the TRANSACTIONS Table I'd like to having running totals in Column F based upon whatever category is selected in Column D. This is so I can see the balance for each Category at any particular transaction date.

The formula does not need to refer to the end of financial year date as the TRANSACTIONS Table is for the current year only. The formula would just need to refer to the opening balance (PREVIOUS EOFY TOTAL) for each Category which is stored in Column B of the SAVINGS SUMMARIES Table.


The results of the formula would look like this in Column F of the TRANSACTIONS Table.

Hope this all makes better sense.


Jul 13, 2022 8:18 PM in response to bzabbia

Thanks for the clarification! You can try something like this:




The formula in F2 of the Transactions table, filled or copied down the column:


=XLOOKUP(D2,Savings Summary::A,Savings Summary::B,"NF")+SUMIF(D$1:D2,D2,E$1:E2)


This has "expanding ranges" to calculate the running total.


The formula in C2 of Savings Summary, filled down:


=XLOOKUP(A2,Transactions::D,Transactions::F,"NF",0,-1)


The -1 means search from last to first. That way it finds the last entry for that category in the Running Total column.


SG

Jul 14, 2022 7:50 PM in response to SGIII

Thanks. Pretty close now. That works for sorting descending on date but the issue I have is when I try to sort descending on Date (Column B) in the TRANSACTION Table, some results are incorrect in the Running Total (Column F). It looks like the running total is still calculated from top down rather then by the order of dates.

Also, I wasn't sure what ROW(CELL) referred to in your formula so I put (F2). Maybe that is the issue ?


Sorted Ascending by Date

And sorted descending on by Date


Jul 23, 2022 6:23 AM in response to bzabbia

I suggest a couple changes to your table:

1) remove the TRANSACTION column

2) add a new column AFTER the column named AMOUNT. Call this DEPOSIT

3) rename the column AMOUNT as EXPENSE


should look something like:

the text you entered and the sig of the number in your example conflict, so, I made an attempt to make the example consistent... that is "Eating out" is always an expense... unless you are meaning it as an indication of a business expense that was reimbursed.


Now use the built-in Numbers feature Categories as follows:


1) select the table

2) open the table Organizer panel then click the "Categories" segment:


3) Add a category and choose the "CATEGORY" column:


you should get this:


5) add category summaries as needed. In the above screenshot, I already selected one possible location. Select the Expense header for any CATEGORY, then choose from the contextual menu:




If you do not want to see the table arranged like this, turn off categories:

Jul 13, 2022 8:55 PM in response to SGIII

Thank You SG. That works. The only issue I have now is - if I sort by Category (Column D). The results in Column F are incorrect.

How can I maintain the formula working if I sort ascending or descending on different columns within the TRANSACTIONS table ?


I also added an IFERROR around your formula to return 0 value if no such Category exists in the SAVINGS SUMMARIES Table so


IFERROR(XLOOKUP(D2,SAVINGS SUmMARIES::A,PREVIOUS EOFY TOTAL,"NF")+SUMIF(D$1:D2,D2,E$1:E2),0)

Jul 23, 2022 7:19 PM in response to Wayne Contello

Thanks for taking then time to do that Wayne.

I wanted to have running balance based on the previous end of financial total for each category and reflective of the date of entry of the transaction, so I don't think organising like you have explained would work.

SG's solution works very well except when sorting by descending date. I probably won't sort descending by date very often so I think I'll stick with his solution atm.

Regards

Ben


HOW TO CREATE RUNNING TOTALS BASED ON CATEGORIES

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.