Using SUMIF formula with Multiple Sheets

Hi Community,


Starting in 7/2023, I created a budget template as follows:


For the month of July, I created:


Sheet 1 - A list of every transaction in July (from multiple bank account statements), assigning each transaction to a budget category (fuel, groceries, insurance, etc).


Sheet 2 - A list of budget categories and a budgeted monthly amount for eachcategory, along with a comparison of budget vs. actual expenses for each category. To accomplish this, I created a SUMIF formula for each BUDGET CATEGORY that retrieves all transactions from Sheet 1 that are in each given category (ex. groceries). To accomplish this, I used this SUM IF formula in the ACTUAL column , and it worked like a charm:


SUM IF [7/2023 Transactions::Transactions::Category],[A1],7/2023 Transactions::Transactions::$Amount]

[A2]

etc, etc, etc


So, for example, I had 15 Grocery purchases during the month of July appearing on Sheet 1. With the above formula, all 15 of those purchase amounts are succinctly retrieved from Sheet 1 (Transactions), and applied on Sheet 2 (Budget v. Actual), in the Actual Expenses/Groceries cell.


Now, for this month (August), I proceeded to duplicate Sheets 1 (Transactions List) & 2 (Budget v. Actual Expenses by Category) and change their names from 7/2023... to 8/2023... thinking I could then zero out the formulas and recreate them and that Sheet 4 (August Budget vs Actual) would pull data from Sheet 3 (August Transactions), repeating what I did with Sheets 1 and 2 (for July) on Sheets 3 and 4.


Nope ...


My SUMIF formula on my Sheet 4 is retrieving data from Sheet 1, not Sheet 3.


Can someone please explain how to pull data from a specified sheet when building a SUMIF formula?


Thank you!




iMac 21.5″, macOS 12.6

Posted on Aug 1, 2023 12:29 PM

Reply
Question marked as Top-ranking reply

Posted on Aug 6, 2023 6:26 PM

To specifically answer your question about pulling data from a specified sheet, whether it applies to SUMIF or another function, there are a few functions that can be useful:

INDIRECT: to use a string built with parts from different sources as a cell or range address

REFERENCE.NAME: to get the name of the sheet where a certain cell of a certain table is located.

TEXTBEFORE: to quickly obtain the left part of a character string, up until a specified character. In your case to get the month and year of the sheet name.


Therefore you could use these building blocks to build your SUMIF and other formulas. If you use the same blocks for many formulas I suggest creating a small table (named Refs for example) with them to calculate them only once per sheet.

REFERENCE.NAME(B1,2) : placed in cell B1 on table Refs on sheet 7/2023 Budget v. Actual Expenses by Category, the result would be '7/2023 Budget v. Actual Expenses by Category'::Refs::B1

TEXTBEFORE(B1," ") : placed in cell B2, the result would be '7/2023

B2&" Transactions'::Transactions::" : placed in cell B3, the result is the base for all cell addresses on the Transaction table of the ...Transaction sheet.

INDIRECT(B3&"Category") is now a function you can use wherever you need to refer to column Category on the sheet of the matching month.


All this combined, the Summary table could include a formula like:

SUMIF(INDIRECT(Refs::$B$3&"$Categories");$A2;INDIRECT(Refs::$B$3&"$Amounts"))






JL

Similar questions

2 replies
Question marked as Top-ranking reply

Aug 6, 2023 6:26 PM in response to abarn

To specifically answer your question about pulling data from a specified sheet, whether it applies to SUMIF or another function, there are a few functions that can be useful:

INDIRECT: to use a string built with parts from different sources as a cell or range address

REFERENCE.NAME: to get the name of the sheet where a certain cell of a certain table is located.

TEXTBEFORE: to quickly obtain the left part of a character string, up until a specified character. In your case to get the month and year of the sheet name.


Therefore you could use these building blocks to build your SUMIF and other formulas. If you use the same blocks for many formulas I suggest creating a small table (named Refs for example) with them to calculate them only once per sheet.

REFERENCE.NAME(B1,2) : placed in cell B1 on table Refs on sheet 7/2023 Budget v. Actual Expenses by Category, the result would be '7/2023 Budget v. Actual Expenses by Category'::Refs::B1

TEXTBEFORE(B1," ") : placed in cell B2, the result would be '7/2023

B2&" Transactions'::Transactions::" : placed in cell B3, the result is the base for all cell addresses on the Transaction table of the ...Transaction sheet.

INDIRECT(B3&"Category") is now a function you can use wherever you need to refer to column Category on the sheet of the matching month.


All this combined, the Summary table could include a formula like:

SUMIF(INDIRECT(Refs::$B$3&"$Categories");$A2;INDIRECT(Refs::$B$3&"$Amounts"))






JL

Aug 1, 2023 6:06 PM in response to abarn

I highly recommend having a look at the excellent 'Personal Budget' template at File > New in your menu. It is a good example of how to use SUMIF (in the Actual column of the Summary by Category table on the first sheet.




I made an expanded version of this template (with multiple months, using SUMIFS). You can find it here (Dropbox download).


SG



This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Using SUMIF formula with Multiple Sheets

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