SUMIFS using two unrelated Tables in Excel on same rows - excel

When building a financial model that is set up using multiple unrelated tables, however on the same rows across the worksheet, I am having trouble with structuring formulas the same way as you would with a single Table in Excel.
The very first table is a summary table of different projects and columns with different characteristics of each project, and the subsequent tables for the same rows to the right are structured with months/years as table headers and financial information for each period. I am now trying to build formulas that summarize information in these tables by using SUMIFS formulas that take characteristics of the projects as criteria. Typically, this would look like:
=SUMIFS(BacklogTable[des.21],ProjectsTable[Segment],"Healthcare")
Under circumstances where all this data would be part of the same table, this would yield the result I am looking for. However, as these two tables are not connected in any way, the formula returns #VALUE.
I have noticed that referencing the same row of another Table works just fine. Standing in the cell of Table2 and referencing the same row of Table1 (Table1[#[Segment]]) returns the correct value from Table1.
Is there a way to modify the formula such that Excel can interpret criterias that stretch across an entire Table column and match it with the corresponding same rows of a different Table?
Screenshot of the problem
Data Relationships in Excel does not seem like a solution. The problem can of course be resolved by adding the same information in the summary table to every other table, but for future projects it would be nice to know if using multiple tables can be a way to structure large models.

Related

Using IF with AGGREGATE

While I am a longtime 'lurker' and have gleaned a great amount of Excel knowledge through this site, I've never asked a question before. This time I'm really stumped...
I have a table with multiple columns. The data I'm working with is obtained from a multiple VLOOKUPs of another workbook for which I do not own. That workbook has some issues with hidden characters and rows that are hidden. I'm trying to create a dashboard from this data and was successful using the AGGREGATE function (2,7) to COUNT and omit the data I don't want.
The next tier for this data needs to incorporate a lookup against another column (image attached). For this, I want to look up data in column B and subtract cells in column C if the data in column B matches a cell in column A.
I have tried multiple ways of doing this but I think that AGGREGATE might be the best approach since it can ignore hidden data and rows.
My latest attempt was to add an IF statement as follows, but that results in a SPILL condition:
=IF('Transport Calendar'!E2:E830='Transport Calcs'!M6,AGGREGATE(2,7,'Transport Calendar'!X2:X830)-AGGREGATE(2,7,'Transport Calendar'!Z2:Z830),"FALSE")
Any help would most certainly be appreciated!

Excel Macro to perform a formula where one column has the same value in several rows

I can't quite find the right code example to do what I'm looking to do.
We have an excel file with data from a project where a request can have several TASKs associated with it and different teams or organizations can be assigned. I'm trying to create a summary of whether the request was worked on by one team or another or "jointly" worked on (based on more than one team/org being assigned to tasks under the same request).
Here is the example and the result I'm looking for:
I want the code to be able to loop thru all rows checking where column A (request #) is the same value and builds an array of the value contained in column B (Team assigned) for each row where A has the same value. Then some sort of function to determine if the values in the array contain more than 1 team. If all of the TASKs were worked on by one team, just that team is the result, if more than one team worked on TASKs, the it results with "Joint".
This can be done without VBA, using formulas.
For the Result column in my screenshot, column E, I used
=IF(COUNTIFS([request],[#request],[team],[#team])=COUNTIFS([request],[#request]),[#team],"Joint")
The same formula without structure references reads like this:
=IF(COUNTIFS($B$3:$B$22,B3,$c$3:$c$22,c3)=COUNTIFS($B$3:$B$22,B3),E3,"Joint")
Apply the formula to the whole table column. If you don't want to use structured references, make sure to use absolute references for the column ranges, i.e. $B$3:$B$22 etc.
The Pivot table has Request and Result in the row areas, and the Tasks in the Values area. A pivot table needs to be refreshed when new data is added.
A dynamic result table can be achieved with the new dynamic array formulas available in Office 365 versions of Excel.
In H12 and I12 of my screenshot I use
=UNIQUE(Table1[request])
=XLOOKUP(H12#,Table1[request],Table1[Result])
The formula automatically spills down as far as required.
So, no VBA required, which means you can save as a regular .xlsx file, which will also run perfectly fine in the browser and on mobile devices.

Using arrays and table names for unique value list

I am building a summary tab in an excel workbook that is linked to numerous other workbooks to track hierarchical business data (ie. Numerous files for subordinate teams exchanging data with a master workbook that tracks them all). To make it easier and to increase uniformity, I'm using tables for all of the data and "building" table names based on each spreadsheet's specific criteria -- then using INDIRECT to bring the table references to life and complete my calculations.
To simplify the formulas I'm using, I've been using arrays to check all tables at once for pieces of data. For example, I've built a table for subordinate units (Ref_Units) which contains the units' names: ABC, EFG, XYZ. I then have a table (Ref_Tables) translate my Ref_Units into standardized table names. Formula is something like {=Ref_Units&"_2016_Sales_Rpt"}. Now I can make some SUMIFS using Ref_Tables that look in several different locations for data -- and to make updates, I only have to change Ref_Units.
My Summary tab will be the culmination of data coming from a dozen+ tables and upwards to 10 workbooks. The basis of the summaries are gathered from drop down lists specifying categories and years being summarized; these values are plugged into some INDIRECT formulas to generate table names and voila.
Now, the problem: let's say each unit records sales numbers and projections for specific items like "televisions", "stereos", "flatware", "candles", etc. and each of these items has also has a category accompanying it: "Electronics","Homewares", "Decor", etc.
I want a summary spanning all of the units' data pulling the numbers in each category (I should note that categories may change each month, so the list must be dynamic). To make the list dynamic (and to give myself the ability to summarize based on other criteria), I am using a formula I found online to generate a list of unique/distinct values.
Right now, I'm using INDEX/MATCH and COUNTIF to generate a unique list of categories. So, my unique list starts in cell C9 and the formula looks something like this:
{=iferror(INDEX(INDIRECT(Ref_Tables&"[Category]"), MATCH(0, COUNTIF($C$8:C8, Ref_Tables&"[Category]"), 0)),"")}
This function will not work. The only way I can get the desired results is to input multiple iterations of the formula, each using a single table name from Ref_Tables and joined with &.
Example:
{=iferror(INDEX(INDIRECT("ABC_2016_Sales_Report"&"[Category]"), MATCH(0, COUNTIF($C$8:C8, "ABC_2016_Sales_Report"&"[Category]"), 0)),"")&iferror(INDEX(INDIRECT("EFG_2016_Sales_Report"&"[Category]"), MATCH(0, COUNTIF($C$8:C8, "EFG_2016_Sales_Report"&"[Category]"), 0)),"")&iferror(INDEX(INDIRECT("XYZ_2016_Sales_Report"&"[Category]"), MATCH(0, COUNTIF($C$8:C8, "XYZ_2016_Sales_Report"&"[Category]"), 0)),"")}
**Remark: the look up arrays are strangely input here because they are actually cell references pulling in table name and column name being looked up, then brought to life with INDIRECT
Partially my problem is that the resulting formula is about 10 lines long which looks horrible, but it also looks too confusing to anyone using the workbook.
Is there any way to get the INDEX/MATCH to look at multiple tables for generate the list that is more concise?
I should note that my boss refuses to use VBA/macros/pivot tables because there are not many in my office skilled enough to troubleshoot issues in these areas. Help?

Changing range in a lookup formula based upon a value

I have a very large excel file with approximately 200 sheets with fields. Each sheet is a ranking of a subset of values which was output from an R program. There are 2 versions for about each entry. The subset data is not in the original sheet - only the name of the sheet, and the summary table i'm trying to build. I'd like to automatically determine which range (sheet) the lookup queries.
The Manual answer is to sort, filter create a lookup and consolidate the summary data, copy the formula, find replace the range reference, fill, repeat. hopefully there is a solution rather than copy-pasting, editing, hundreds of times.
You may want to re-think the data architecture. If possible, let the golden rule apply to have data in one sheet and reporting on other sheets.
Find a way to have all the 200 sheet's data in just one sheet. You may have to introduce a few additional columns to distinguish each row.
Then you can start building reports on all the data, using Pivot Tables, or more sophisticated tools like Power Pivot.
With the next to nothing info you provide about your data set it is hard to suggest more concrete advice.

Retrieving multiple rows from multiple sheets

I would like to know the best way to approach this problem. I want to search multiple sheets of data based on customerid and retrieve data from each sheet such as customer address(es), customer order(s), customer personal information, etc.
Options off top of my head is...
Filter Pivot Tables by customer but would I do that automatically for all sheets?
vlookup data into one sheet based on customer search term
Is there a way to use an SQL-type command to query data from sheets and display?
I would like to retrieve similar to a SQL query but without use of macros. I don't see a way to retrieve data from these different tables in an automated fashion.
Vlookup basically falls apart the moment you multiple data sets for the same key (for example, 10 order rows for 1 cust_id) unless you make some kind of complex formula to get all of the items and predict how many you need.
I've used 2 solutions for this kind of problem:
1: Several pivot tables on the same sheet, each linked to their respective tables. Unfortunately, the user has to select the same filter for each one as needed. This is still the cleanest solution and I recommend it.
2: Make a translation table (sheet) that glues all of the other tables together.
Each cell just points to the other sheet. Pivot this
For example, if you have table 1 as ID, NAME, ADDRESS and Table 2 as ID, ORDER you might end up with a giant sheet of formulas:
A1 as =Names!A1
A2 as = Names!A2
B1 as =Vlookup(Orders!A1...)
Fill down as needed.. use formulas on this sheet to link the data as needed. You're basically simulating SQL table joins and yes it is a pain but can be done! =) Provided any of this works for your data sets, in theory you could then make 1 large pivot table.

Resources