EXCEL: multiple condition count and data listing/summary - excel

I need to do a multiple condition count and data listing/summary in EXCEL.
I have an EXCEL file with the following:
A B C D <-- Columns
tennis Jan 4 Smith John
tennis Jan 4 Fellows Todd
tennis Jan 4 Biebs Justin
football Jul 8 Smith John
football Jul 8 Rucker Pete
tennis Aug 7 Smith John
etc...
I have to figure out by Last name/First Name (col D/col C), which activity they participated in (and it could be multiple times (ie - tennis on Jan 4 and Aug 7)).
I've researched VLOOKUP and countif and I can make them work on other files but I can't get them to work with this one. I know I could sort by names and manually count but trying to figure out a way to use multiple conditions to get the answer (without having to manipulate the file too much because it is not my file in terms of who is entering the information).
Any help is appreciated (even if it requires partial manual effort!) Anything is better than manually sorting the file multiple different ways.
Thanks!
-Dan

I suggest:
two extra columns in your source data. One (say wk) with =WEEKNUM(B2), the other (say bod) with =E2&", "&F2 and both copied down to suit.
a single pivot table (the fields can be rearranged to get different 'views' and/or filtered/sorted/grouped to suit)
If you find multiple activities for the same bod for the same wk, then click on the counts that are greater than 1 and the details should help to determine whether adding a flag may be appropriate, to distinguish camps.

Related

How to systematically and programmatically set up rows to hide/collapse underneath an associated main row in Excel?

I have an Excel report with a table that is getting it's data from a CSV file that gets updated every few months from a python script running a SQL query.
My Excel file has the following data structure:
Student_ID
Student
Class
Grade
Year
d9fs73l41
Bob M.
PSY103
B
2022
d9fs73l41
Bob M.
PHL302
A
2021
d9fs73l41
Bob M.
MTH112
C
2020
d0s83jfos
Jul S.
ARG211
C
2021
dofs09sje
Ted B.
UNI321
B
2022
As you can see, it is simply a list of students with their associated ID and course history information containing the course name, the grade they received in that class, and the year they took that class.
OK, now this is what I would like to do with the table: I would like for the Excel file to initially display the data for the latest year for each student, and to keep data for earlier years initially hidden until the user of the Excel file wishes to view that information by clicking on a button next to the row he/she wishes to view, so that the data I mention above would appear like the table below, initially, until the user opts to expand a row on a student to see rows with old data for past years:
Student_ID
Student
Class
Grade
Year
d9fs73l41
Bob M.
PSY103
B
2022
d0s83jfos
Jul S.
ARG211
C
2021
dofs09sje
Ted B.
UNI321
B
2022
As you can see, only the row pertaining to the latest year for BOB is displayed, since I don't want the rows for earlier years to be displayed unless the user wishes to expand them.
Basically, I want to do the exact same thing that I was trying to accomplish in SSRS that I describe in this question.. Also on here, someone else had a similar question, but the answer provided allows for a set of rows to be collapsed/hidden underneath a main row for only one set of rows. In the data that I have, I would like to systematically collapse rows for each set of IDs that I have in the table. Is it possible to accomplish this in Excel automatically/programmatically with VBA or through some other means?

Sum product for all the months if 2 tables match

So I have this issue, I have two tables one is employees, and another one is the projects.
Employees Table:
Year Name Type Jan Feb
2018 Kevin Salary 5000 2000
2018 Kevin Insurance 200 400
2018 Alex Salary 3000 4000
2018 Alex Insurance 300 400
Projects Table
Year Project_Name Employee_Name Jan_Hours_Worked Feb_Hours_Worked
2018 Apple Alex 7 5
2018 Apple Kevin 5 0
2018 LG Kevin 0 3
Now I am creating a result list of all the projects and costs recurred for them, what I need is for each project in Table 2 to find which employees are involved and then use that to find related costs for the employee from the Table 1 and calculate total costs for that project.
(e.g for project LG, I have Kevin working on that in Feb,for him company paid 4400(salary+insurance) in Feb and the costs recurred for the LG project would be 4400 divided by hours spent on the project which Kevin in total spent 3 hours; e.g.2 for the project Apple it would be the same but sum of Kevin's and Alex's costs from Jan and Feb, so Kevin: 5200/5 + Alex:3300/7 + 4400/5)
Now I have the formula to calculate this for 1 months which is something like this
=SUMPRODUCT(SUMIFS(Employees[Jan], Employees[Name],Project[Employee_Name], Employees[Year], 2018 )/Project[Jan_Hours_Worked],--(Project[Project_Name]=K14))
I need to find how to get the yearly result per project without repeating the formula 12 times, also with this formula, i get div to 0 error when an employee didn't work on particular months, so that needs to be sorted somehow. Any Help?
I suggest you to change how you store your data. If you can make some minor changes, then you can have an easy way to get the information you want, and also a Pivot Table with a summary of cost recurred for each proyect and which employee generated that cost.
IMPORTANT: For this answer to work, you must make sure that every Employee's Name is UNIQUE. If not, adapt the example trying to create
an Employee's ID or something.
Also, please, note i got a spanish version of Excel, so screenshots are in spanish but I will translate formulas :)
Ok, first of all, I changed the design of your table Employees. Creating a column for each month is kind of annoying. Use just a column to get the month. You can type the month in a cell just like 01/2018 and Excel will change it instantly to format mmm-yy (Jan-18)
This is how your Employees table should look:
The column TOTAL COST is just a sum of SALARY + INSURANCE. If you have any other concept, just add it as a column and modify the TOTAL COST COLUMN to include it.
Second, the table Project, I think it should be like this:
The column Employee Cost has an Array Formula.
IMPORTANT: Array formulas are inserted pressing CTRL+SHIFT+ENTER
The formula is (I used same names for tables, so copy-pasting should work for you):
=INDEX(Employees;MATCH(Project[[#This row];[Employee_Name]]&Project[[#This row];[Month]];Employees[Name]&Employees[Month];0);COLUMN(Employees[[#Headers];[TOTAL COST]]))
If you typed the formula right, you should see { at start and } at end.
The formula in Cost Recurred to Project is just a division of Employee Cost / Hours. Added an IFERROR when the hours worked are 0, then show 0.
=IFERROR(Project[[#This row];[Employee Cost]]/Project[[#This row];[Hours]];0)
And last step, your Pivot Table. Create one and organise it to get the sum per hours and month and proyect you want. You can get one like the one below:
As you can see,e.g. for project Apple, you can see that total cost is 2.391,43
but also you can see the cost of each Employee. Pretty cool I think.
I really hope you can modify the design of your data, because Excel is designed to work going down (I mean using rows) more than using columns. Excel 2007 got more than 1 million of rows and just around 16.000 columns, so it's designed to work vertically.
Hope this helps, or at least, give to you a clue of how to proceed :)

Merge two excel sheets when UserId match in both sheets

I am currently mapping the usage of an application. The app have more than 5000 users and each of those users have different prerogatives. Because this an application used by employees of a company the only way I can segment those users is by using their coresponding service.
I have two seperate excel sheets that look like this:
1/
UserId N°connection/month
1 34
2 21
3 3
4 67
5 2
2/
UserId Name Service associated
2 Peter Department 1
5 Lily Department 2
3 Sarah Department 3
1 Gary Department 1
4 Joe Department 4
What I would like is to join those two separate excel sheets. Excel needs to merge those different informations by UserId.
So what I am looking for looks like this:
UserId N°connection/month Name Service associated
1 34 Gary Department 1
2 21 Peter Department 1
3 3 Sarah Department 3
It is important to know that the two excel sheets have a different number of rows.
Does anyone have a solution ?
Thanks in advance
VLOOKUP will work, but I would suggest INDEX and MATCH be used together - it is faster and is less fragile than VLOOKUP. It also doesn't require the UserID to be at the beginning of the row. A quick search will yield a result.
I don't know if I got your question. But if I did, this should be pretty easy to do using VLOOKUP formula on the merged sheet.
This link might help: https://www.techonthenet.com/excel/formulas/vlookup.php

Excel Graphs - Exclude someone who is off

I have data, in two separate columns, that shows people and how many products they have sold in the previous day:
Alan 12
Gareth 7
Kristina 8
Fred Off
Emma 7
What I would like to do is not include Fred in the graph as he was off for that day. Is there an easy way to exclude someone if they were "off"?
Any ideas are appreciated :)
Just Add a filter in those columns. Now filter the column to remove the value Off. The graph will be updated automatically.

Excel: Matching 1500 names (Column A) with Supervisors (Column B) and placing Identifier in Corresponding Column C,D,E,etc

I have a list of names with their direct supervisor that I am trying to expand upon by showing the employees the next few layers down that work for the list of names.
Column C of the linked image brings back results of 1-7 by matching the list of names in A to those in the column of 7 names. This shows that "HB" works for "SW" but that "SW" works for "ZJ," so "HB" is technically under "ZJ" too. What I am hoping to accomplish is to have a result similar to that shown below (or something that will show the employees under each supervisor). As shown below, in the data there are many names not being searched for but that are needing to be mapped to those that are being searched for. At the current count there are 1500 employee names with 7 of them being the ones searched out of a list of 143 supervisors that repeat for the employees.
Names to Look for: "Fictional names used for scenario"
Sam W. (SW) 1
Robert R. (RR) 2
Kegan G. (KG) 3
Isiah B. (IB) 4
Orville E. (OE) 5
Robert J. (RJ) 6
Zach J. (ZJ) 7
Column A Column B Column C Column D Column E
Superv. Employ.
HB PJ 7
SW HB 1 7
BE JR 2
HB IL 1 7
IL AP 1
BE WP 2
RR BE 2
KG JW 3
JW JH 3
ZJ SW 7
These results would then be used to create lists of employees under a certain person.
Things I'm not sure affects this would be how the name is constructed in the workbook. Example Sam W. is listed as Wilson, Sam in the workbook.
Of course if there is another way to achieve the final result that would be easier then I wouldn't mind an altered format to what I currently have. If anyone has an idea how to achieve this please respond. If there are any questions about more specific things in the workbook that I could supply that could help resolve this quicker also let me know for any future inquiries I may have. Thank you.
Well, if I understand what you're asking, you need to normalize your data. In this case, that means creating two tables linked by an employee code that you'll need to create.
Once you have these two tables, you can easily perform any query and summary report you need.
Giving a range that contains the 7 names and next to them 7 numbers the name AUarray then in C3 and copied down to suit:
=IFERROR(VLOOKUP(A3,LUarray,2,0),"")
and in D2 and copied down to suit:
=IFERROR(VLOOKUP(INDEX(A:A,MATCH(A3,B:B,0)),LUarray,2,0),"")
I think something similar (but maybe a lot longer!) would work for ColumnE but I don't have time for that at present.
`

Resources