I have the following formula in the 'Available Staff' sheet:
=LET(AvailabilityCalc,FILTER(AllStaffProjectAllocationTbl, IF(ISBLANK($I$11),1,(AllStaffProjectAllocationTbl[Role]=$I$11))*IF(ISBLANK($I$8),1,(AllStaffProjectAllocationTbl[Employee]=$I$8))*IF(ISBLANK($I$14),1,(AllStaffProjectAllocationTbl[Discipline]=$I$14))* (AllStaffProjectAllocationTbl[End Date]<$I$2)*(TRANSPOSE(MMULT(SEQUENCE(1,ROWS(AllStaffProjectAllocationTbl),1,0),TRANSPOSE(AllStaffProjectAllocationTbl[End Date]>TRANSPOSE(AllStaffProjectAllocationTbl[End Date]))*(AllStaffProjectAllocationTbl[Employee]=TRANSPOSE(AllStaffProjectAllocationTbl[Employee]))*(1)))-MMULT((TRANSPOSE(AllStaffProjectAllocationTbl[Employee])=AllStaffProjectAllocationTbl[Employee])+0,SEQUENCE(ROWS(AllStaffProjectAllocationTbl),1,1,0))+1=0)),IFERROR(SORT(INDEX(AvailabilityCalc,SEQUENCE(ROWS(AvailabilityCalc)),{1,4,5,9}),4),""))
that sits in A2 and pulls in all staff that are available after a specific date defined in I2. This unfortunately has an issue as it pulls the data from the staff that have been allocated to a project previously from a 'Staff Project Allocation' sheet and doesn't incorporate the staff from the 'Staff Details' sheet that are yet to be allocated to a project.
The 'Staff Project Allocation' sheet :
The 'Staff Details' sheet :
Someone kindly helped me with the above function and I'm not sure how to modify it to do what I want. Could it be simpler to keep the above as is and create a new set of data to the right of it say, that pulls in the entries from the 'Staff Details' sheet that don't appear in the data created by the formula and are available from the date specified - whilst also being a development role, which I can do by checking their discipline against another table? Or is there a way to modifiy the formula above to incoporate the data? Something I also need to incorporate in the above function, which I overlooked originally, is to exclude any staff member that has had their employment terminated as noted in the Employment Status columns, so any suggestions on how to incoporate this too would be greatly appreciated.
I'm also starting to wonder whether a VBA solution maywell be a better approach, thoughts?
Edit 1
Adjusted function based on the suggestions from Max below. This now includes the ability to filter based on the employment status.
=LET(
staff, AllStaffProjectAllocationTbl,
employee, AllStaffProjectAllocationTbl[Employee],
role, AllStaffProjectAllocationTbl[Role],
discipline, AllStaffProjectAllocationTbl[Discipline],
endDate, AllStaffProjectAllocationTbl[End Date],
employmentStatus, AllStaffProjectAllocationTbl[Employment Status],
rowCt, ROWS(AllStaffProjectAllocationTbl),
roleSelection, $I$11,
employeeSelection, $I$8,
disciplineSelection, $I$14,
availableFromDate, $I$2,
empStatusSelection,"Employment Terminated",
mmult_1, MMULT(SEQUENCE(1,rowCt,1,0),TRANSPOSE(endDate>TRANSPOSE(endDate))*(employee=TRANSPOSE(employee))*(1)),
mmult_2, MMULT((TRANSPOSE(employee)= employee)+0,SEQUENCE(rowCt,1,1,0)),
roleCondition, IF(ISBLANK(roleSelection),1,(role=roleSelection)),
employeeCondition, IF(ISBLANK(employeeSelection),1,( employee=employeeSelection)),
disciplineCondition, IF(ISBLANK(disciplineSelection),1,(discipline=disciplineSelection)),
empStatusCondition, NOT(employmentStatus=empStatusSelection),
AvailabilityCalc,FILTER(staff,roleCondition*employeeCondition*disciplineCondition*empStatusCondition*(endDate<availableFromDate)*(TRANSPOSE(mmult_1)-mmult_2+1=0)),
IFERROR(SORT(INDEX(AvailabilityCalc,SEQUENCE(ROWS(AvailabilityCalc)),{1,4,5,10}),4),"")
)
Edit 2
I now have two tables, one from the Staff Details sheet, showing all staff who are development staff and still employed, this can be seen on the left in the following image (note this all staff allocated to a project or not) and defined by =FILTER(FILTER(StaffDetailsTbl,(StaffDetailsTbl[Employment Status]<>"Employment Terminated")*(StaffDetailsTbl[Dev Role]="Yes")),{1,1,1,0,0,0,1,0,0}), and a separate table defined by the Let function above in edit 1, showing all staff allocated to a project that are available based on a specified date, see table on the right.
I'd now like to merge the table on the left into the table on the right whilst also removing any duplicate entries. Would the most logical first step to be to adjust the filter for the left table to exclude entries that are in the right table? Then look to merge the two in to the right table somehow? Or is it possible to take the Filter defining the left most table and work it directly in to the function defining the right table?
Edit 3
The following function now filters out the entries from the StaffDetailsTbl Table that don't exist in the AllStaffProjectAllocationTbl Table:
=FILTER(FILTER(StaffDetailsTbl,(StaffDetailsTbl[Employment Status]<>"Employment Terminated")*(StaffDetailsTbl[Dev Role]="Yes")*(IF(ISERROR(VLOOKUP(StaffDetailsTbl[Employee], AllStaffProjectAllocationTbl, 1, FALSE)),1,0 ))),{1,1,1,0,0,0,1,0,0})
Giving the resulting table on the left for staff not allocated to a project and those allocated to a project and who are available after a specified date on the right:
I now need to figure out how to merge the filter formula from the left table in to the Let function above, or alternatively, build another table from the two that supports all the roleSelection, employeeSelection, disciplineSelection and availableFromDate functionality. Any thoughts on the best way I can do this please?
The formula logic is complex enough that it's unlikely someone here would be able to invest the time required to work through this on their own. It means someone has to "reverse engineer" the meaning of every reference, like "what does $I$11 really represent".
While not technically an answer, I can provide some help on how to simplify the problem, and then document the logic for your future reference. This won't meet the technical definition of a "proper" StackOverflow answer, but it's too much to fit in a comment and still better than leaving you empty-handed.
Use LET to simplify
You already have it, so let's go further with it, so we can simplify the formula as much as possible. Here's one example of using LET to further break down the formula, and using alt-Enter to create non-breaking returns in the excel formula:
=LET(
staff, AllStaffProjectAllocationTbl,
emp, AllStaffProjectAllocationTbl[Employee],
role, AllStaffProjectAllocationTbl[Role],
disc, AllStaffProjectAllocationTbl[Discipline],
endDate, AllStaffProjectAllocationTbl[End Date],
rowCt, ROWS(AllStaffProjectAllocationTbl),
mmult_1, MMULT(SEQUENCE(1,rowCt,1,0),TRANSPOSE(endDate>TRANSPOSE(endDate))*(emp=TRANSPOSE(emp))*(1)),
mmult_2, MMULT((TRANSPOSE(emp)=emp)+0,SEQUENCE(rowCt,1,1,0)),
roleCondition, IF(ISBLANK($I$11),1,(role=$I$11)),
empCondition, IF(ISBLANK($I$8),1,(emp=$I$8)),
discCondition, IF(ISBLANK($I$14),1,(disc=$I$14)),
AvailabilityCalc,FILTER(staff,roleCondition*empCondition*discCondition*(endDate<$I$2)*(TRANSPOSE(mmult_1)-mmult_2+1=0)),
IFERROR(SORT(INDEX(AvailabilityCalc,SEQUENCE(ROWS(AvailabilityCalc)),{1,4,5,9}),4),"")
)
This is still a lot to take in, but it separates the complexity of how we found/calculated the inputs from the actual Filter and Result logic at the end. if it was my sheet I'd go further and break the formulas down even more, like giving $I$8 or "transpose(emp)=emp+0" a name as well. The more granular, the better.
Then Document your LET formula right in excel
On another sheet, create an Excel table that documents the LET parameters:
Name
Equates to
Which means
disc
AllStaffProjectAllocationTbl[Discipline]
Discipline Col of Staff Table
roleCondition
IF(ISBLANK($I$11),1,(role=$I$11))
Role from I11, or 1 if I11 is blank
xyz
$I$11
describe what I11 is
I put "xyz" in row 3, but the point is to give a name to each thing, if you are not using name manager.
Hope this helps, either to add clarity for you, or to get someone else started creating a full answer.
nothing stuck or broken, just I am inspired after a discussion with another Excel author.
His situation:
Read from an existing Excel monster file (column FG), and hard-coded the following
Range("FF:FG").Copy
Potential issue:
data in FF:FG will be pushed to GF:GG every couple of months because newer columns will be inserted in between. (It's a pivot-like design... sorry, but end-users need this appearance, but categories are increasing, summary need to be at right end side)
He has 2 other choices (if he don't want to maintain VBA code every few months):
A: Store "FF","FG" in a Cell (fixed location!), then read the location parameter using VBA
B: Read a second dedicated CSV file (copy/paste from the monster file, consumed by another user so available readily), it only has the 2 columns required..
To me, none is obviously better than the other, just a matter of preference.
Similar but simpler Scene of mine
I produce the monstrous file by lots of Vlookup from manual data sources (inherited the design... and I refactored the design using another automation tool but there is license consideration atm).
In a column there is a formula doing something like
=if(A1="SALES PERSON SICK","void result",(if(A1="MACHINE BROKEN",C2*0.8),"")..
say 5000 rows with this formula
To reduce hard-coding I moved
"SALES PERSON SICK","MACHINE BROKEN" to a reference sheet cell A1,A2, and changed formula to:
=if(A1=Ref!$A$1,"void result",(if(A1=Ref!$A$2,C2*0.8),"")
I feel it's a good practice.
Question: Is method A or B better? Considering column position will move every ~3-6 months, still worth choosing 1 from A/B?
data in FF:FG will be pushed to GF:GG every couple of months because newer columns will be inserted in between
Then you should use named ranges in what you call "monster file" (see Define and use names in formulas) and use them in your VBA.
Eg define a name for Columns FF:FG like CopySource (use a name that describes the data in that columns) and finally you can use that in your VBA code.
Range("CopySource").Copy
Whenever the range moves because new columns are inseted before, the named range moves too, so it still points to the same data.
I'm managing the server awards for a gaming community and using Google Forms for the first time. The voting phase ended, I moved the form responses into an excel sheet in Google Docs.
It goes like this (Answers from 89 forum accounts [ROWS] for 31 questions [COLUMNS])
(https://i.imgur.com/w9ICMjv.png)
The nominations were put as multiple-choice votes in the Forms as can be seen here, if this helps at all.
(https://i.imgur.com/4OQxiKH.png)
Most of the attempts I've read on the internet read back to integer values, whereas I'm using strings. Plus, I really have no idea how to work formulas on Excel.
I need the results to be like this, if possible.
Name One —> Most repeated name in Column C, from Row 2 to Row 30.
(47) —> Amount of times Name One is repeated in Column C.
Name Two and Three show us the second and third most repeated names.
(https://i.imgur.com/EkocuoG.png)
If you are using Google Sheets
To get your top three in column C, add this formula into another sheet.
=QUERY('Your sheet name'!A1:Z100,
// Change the sheet name and the last cell reference to suit.
// Keep the single quotes around the sheet name if it has a
// space or a non-alphanumeric character in it.
"Select C, count(C) group by C order by count(C) desc limit 3")
Thanks to #pnuts's answer on another question for allowing me to double check without turning on my laptop. :)
Have tested it and it's working for me.
One of the reports that wastes a bunch of my time at work is the Roster. It's a multi-site, multi-contract listing of every employee currently assigned to a specific client. Currently, it has a little over 6,000 lines by 20-something columns, indexed against 3 different datasets. Not the largest mess in the world, but still a pain. And it's almost all in excel, because I somehow don't have a business case for Access.
But one part of this monster stands apart. One tab per site Site Totals, listing off every time any agent has gone through training. A second tab (again, one per site) Site Data displaying only the most recent training class, and the credentials they had during that class.
That second tab is driven by variations of this array formula - Last_Row is a named range on another tab, and column A is a pivot of the UID column on Site Totals. I've broken it apart for readability:
=IF(INDEX('Site Totals'!B:B,LARGE(($A2=INDIRECT("'Site Totals'!$A$1:$A$"&Last_Row))*
(INDIRECT("'Site Totals'!B1:B"&Last_Row)<>"")*
ROW(INDIRECT("'Site Totals'!$A$1:$A$"&Last_Row)),1))="Trainer",
"",
INDEX('Site Totals'!B:B,LARGE(($A2=INDIRECT("'Site Totals'!$A$1:$A$"&Last_Row))*
(INDIRECT("'Site Totals'!B1:B"&Last_Row)<>"")*
ROW(INDIRECT("'Site Totals'!$A$1:$A$"&Last_Row)),1)))
I know what this formula does, but I don't know how to improve it. This formula needs to be changed, because it currently is on the order of 500 Million calculations (I'm not allowed to delete historical data), and it takes me 3 hours to calculate the workbook ... if it doesn't crash Excel first.
I'm open to VBA and / or custom functions, but would prefer to have native Excel functions. I'm not able to install anything, so any solution must be native Excel, and Must be compatible to Excel 2007.
If your source is a pivot table, try is the GETPIVOTDATA function. You might be able to accomplish what you want without INDIRECT and INDEX.
What i have understood is that every person has/has not attended a training and you want to retrive the name of that training, in case he has not, you want a blank space in the cell. If this description is correct you can try this formua, press ctrl+shift+enter to execute.
=IFERROR(INDEX('Site Totals'!B$1:B$12,MATCH(A2&"Trainer",'Site Totals'!A$1:A$12&'Site Totals'!B$1:B$12)),"")
Here A2 contians the name of the person. I can be more precise with this formula if you can provide some sample data butI would recommend to not to use entire B & Columns in Site Total workssheete as this will definately slow down computing process, instead you can use B1:B8000 or smaller range, to speed up process. Hope that helps.