Using IF with AGGREGATE - excel

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!

Related

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.

Making excel search using one letter in cell

So basically, I have been trying to make excel scan one column and print out the row for cells which have specific letters.
For example I have the following data in my sheet.
What is required is to be have excel search for the values which contain T and I, and then print the new rows. Kind of like separate the two into two different tables, because then so that I can do further analysis on them.
So far I have been trying to use the VLOOKUP() function, but the problem with VLOOKUP() is that excel required a proper match and not just a letter in the cell. I had tried with both FALSE and TRUE. Then instead I tried to use the =INDEX($B$4:$K$9;MATCH($A$17;$A$5:$A$9;0);COLUMN(A4)) to make it work. But that also does not work, since it also requires a full match. Also another problem which I didn't realise before is that how can excel recognise each cell, because I will have different number after the letters everytime and then so how can one make excel not repeat the same row twice?
I have used another approach where I copy the data in a separated sheet and then I simply filter out the Ts and then copy/paste the Is into another sheet and vice versa. it is time consuming and so it would be much better if I can simply copy/paste my new data and it would generate the division on its own.
any suggestions or link would be really helpful.
UPDATE
I had a new idea on how to approach this problem. I was thinking that is it somehow possible to have VBA code running for filtering the data. Is there a way to specify in VBA code to filter the data by "Starts With" and Make the results be printed in another cell block?
Looks simple enough. First step is to make sure you have headers over your data and that it is in proper table format similar to my picture. Then select Data set and press CTRL+T. That should turn you data in to table object with stripes. Use the Formula =LEFT(C2,1) to take out the first letter which will be L or T.
Select the table and press ALT+D+P which will generate a pivot table based off original data set.
Drag the column with the formula I suggested over to the FILTERS area of the pivot table ID column to ROWS and all others to VALUES. Simply refresh and as new data is added you will get new pivot tables. Do not put the pivot tables on top of each other as I did that is only for the picture so you can see it. If you have too many filters to apply you can right click the helper column in the pivot table fields area to produce a slicer which is a button that helps you change the report quickly. Any other questions do ask.

Combining Non-Zero Values from Multiple Columns into One in Excel

Every month I get given a budget from one of our clients in a Google sheet, which I need to convert into a SQL query so it can be uploaded into our database. As the number of rows and columns changes, I want to write some formula to semi-automate the process for time saving and mistake elimination.
This budget has spends in multiple columns, which I've managed to write formulas to combine into one column, with the correct details in the columns next to it (see example links below).
How I've transformed the data so far
The issue is this budget per country and partner, then has to be split again across multiple options. This leaves me with three columns worth of spend values, that I'd really like to combine back into one column, and ideally skip out all the zero values.
I've found an array formula on this site that will skip the zeroes, but I can't get it to work on more than one column.
=IFERROR(INDEX($U:$U,SMALL(ROW(myRange)*(myRange<>0),SUMPRODUCT(N(myRange=0))+ROWS($1:1))),"")
From this Question's Answer
Is it possible to write a formula, that skips the zero values down one column, and then starts at the next? And that will also allow me to keep the correct matching details from the other columns alongside it, as well as bring in the column headers for the options as entries in a new column?
Thanks
Edit:
Here is the final format I'm looking for:
There is a concatenated field off the end that combines all the columns. Most of the values are populated by various Vlookups, to transform from the text version, into the database IDs, needed to fill the table.
It's also worth saying, that not being able to skip the zeros, is OK, as I can manually delete them fairly easily.
But as the number of countries and partners can and will change, I want the formula to be able to move column at the end of the dataset.

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.

Find all duplicate values in one column and combine all its values

So I got this excel file with a lot of data which is why I want to avoid doing all this manually. Basically what I want to do is find all values that is the same in one column and then combine all it's values to one row.
If I have this data in a worksheet.
I would like the output to be like this
I appreciate all the help I can get.
EDIT:
This is what I get from a Pivot Table
When I actually would want it to look like this.
You must use Pivot Table function from (i recommend it) MS Excel.
It lets you to set wich columns becomes rows, what type of values they will contain and much more.
Pivot Tables are what you want.
It saved my career at my previous job :)
Here you got some screenshot of example for making sums for all duplicates in first column:
original table:

Resources