How to do conditional formatting against a range of times - excel

I have a lunch rota which has the names and the times people are going on lunch. I'm trying to make it possible to add a more visual approach to when people lunches are. So that we can see who the number of people available between times.
The idea was to have a list of times in 30-minute increments from 9:00 to 17:00 and with the use of conditional formatting the colour would change gradually depending on the availability.
The complexity comes from certain people either having either 30 or 1-hour breaks. Any idea of how this could be done will be a great help this is to limit people having lunches at the same time and causing issues.
Thanks in advance.
Edit - I've added a link with a screenshot of the concept I'll like to achieve. I have 25 users total across 3 groups and if there's less then 2 available per half hour slot. I'll like the colour to change to orange and then if 1 or less change to red. (Not all 25 users are always in).

I have assumed you want to count the number of users on their lunch break in each time slot. If you need something more you can use my answer as a starting point, e.g. If you want the number of users excluding those on lunch break.
1: Add a new column 'End', D2 =B2+C2, and paste this for each user
2: Add formula in Covered column:
=COUNTIFS(B$2:B$31,"<=" & F2,D$2:D$31,">" & F2)
This formula counts the number of users who are at lunch in that time slot.
Copy this down column G to end at 17:00. The F2 will change to F3 so it is the right time slot, while the users' start and end time ranges will stay constant, because of the $.
3: Apply conditional formatting as needed to column G.

Related

Change values in cells based on data from drop down list

I'm making a basic booking system for our equipment, it's meant to be accessed in a teams folder, where you can either mark X for whole day, or hours the equipment will be used.
How can I connect the weekly schedule with the drop down list? Since I'm not using preset value, but inputs from every time something gets booked.
When I or a coworker change "Vecka:" (Week:) I want the "X" and time stamps to change accordingly. People must be able to book stuff weeks in advance. Preferably I'd also want the date next to the days to be applied aswell.
Maybe so. Mon-Sun even with date, for many weeks. Scrolling to the right. Freezing column A. Enter Weeknumber (combined with year) in A7, press Enter and it will scroll to that week.

Excel - Automatic allocation of preferences

Edit: Example file available here.
I'm not a super experienced Excel user, but I'm trying to automate using IF/AND/INDEX/MATCH to assign yes/no to preferences which competitively listed people have chosen from a list of about 300 choices. Each person has listed 4 preferences, there's over 1000 people in the process, and each person gets one preference out of four. A simplified hypothetical version of it is a situation where I want automate the allocation of employee shifts at a restaurant, with the employee data listed with the best workers at the top and the worst ones at the bottom.
Traditionally the Shift Allocation sheet has been done manually, which is fine when you have seven days of the week and maybe 30 employees. But if I have 300 days of the week and 1000 employees, I don't want to manually allocate each one to their preferences. Or if I do have a manual input, I want it to automate enough shift allocation beforehand so it doesn't take up as much time.
Ideally the automated formula to assign the yes/no indicator for the shift in the Shift Allocation would look at the first preference (day of the week) the person has listed in the Employee Data sheet, check the Shifts Available sheet to find the day of the week and then look at the number of shifts available in column K, if column K is more than 0, assign YES to that employee's preference on the Shift Allocation sheet, then move on to the next employee.
The employees are listed by who gets first pick, so in theory some people at the bottom may not get the shifts they preferenced, or there may need to be other manual changes made after the automatic allocation process for other reasons.
I tried VLOOKUP but the lookup logic wasn't broad enough, so I need something like an INDEX/MATCH parameter to find the shift places available in column K of the Shifts Available sheet after finding the day of the week in Column A.
This is about as far as I got with the code
=IF(AND(INDEX('Shifts Available'!$A$2:$K$8, MATCH('Employee Data'!$A$2,0)), 'Shifts Available'![K-column cell corresponding to the day of the week, unsure how to do this? Keep it in the INDEX?]) >=0)"Yes", "No")
Any help is appreciated.

Calculate minutes in specific period

I have a spreadsheet which has employee working times, listed as Sat-In and Sat-Out for a specific date. The employee shift spans several ours and each "In-Out" period is recorded as a separate line which means the time between the Sat-Out and the next Sat-In means the employee is on a break. I also calculate the time, in minutes of each "sitting" period.
What I can't seem to figure out is how to add a formula which takes the data and further refines it in this manner:
1. I have a core period of 1030-1530, as an example, which is the busy time and requires the maximum employee coverage. The shifts of employees generally spans this core, but in some cases their shift may start or end in the core.
2. I want to calculate how many minutes the employee worked within the core only. I can obviously do this manually using the data, but a formula would be preferred, if possible.
3. As an example, if a person sat-in at 1445 and sat-out at 1545, the core time calculation would be 45 minutes (1445-1530).
I've attached a snapshot of the data to help my explanation.
FYI - the information is pulled from a database as JSON data and converted to excel. I'm not very familiar with JavaScript, but if someone knows a way to do it programatically, I'm willing to give it a try and learn.
Thanks!
![excel]: https://photos.app.goo.gl/dRSTE72CXNa18RzP8
In below example I've used: =MAX(0,MIN($O$2,H2)-MAX($O$1,G2)), and formatted like [mm].
In Excel, units are days, so if you want to calculate the amount of minutes between two timestamps, you need to subtract both and multiply the differencee by 24*60 (being the amount of minutes in one day).
E.g. You start working at 09:07 (cell B2), and finish at 18:07 (cell B3), having a 45-minutes break. Then the time you worked in minutes, is:
=(B3-B2)*24*60-45
Make sure the cell formatting is correct (general), you'll get : 495.

Excel Formula for calculating time in round numbers with hours text

I'm trying to figure out a way to create an excel spreadsheet that will allow me to keep track of how many hours I've earned per each paid holiday my company offers, then keep track of how many hours I've used and what's remaining. But I'm unsure how to calculate this properly.
I could easily do the math my self as it's a simple lay out, but I'm trying to find a way that will just let me enter the numbers for earned and used and walk away from anything else.
What I'm trying to do is the follow:
Have multiple sections. In the first section it'll be my holidays. So in like Column A, working down I'd have New Years, Memorial Day, July 4th, etc. Column B working down would be time earned. But this would be labeled in each cell as "8 Hrs" or "4 hrs". Column C would be time used in the same format "4 hrs" "8 hrs". Then Column D would simple be hours remaining.
Now in the second section I'd have holiday hours earned, which is 2 weeks. Not too sure how to lay it out, and then I still have my sick days, but not sure if I should include that in section 2 or not with the vacation time.
I'd like a way to be able to simply Calculate B2 - C2 = D2. So 8 Hrs - 4 Hrs = 4 Hrs (to show 4 Hrs remaining for each line item.)
Problem is I'm unsure how to calculate remaining time simply because of the Hrs suffix. And with that I also can't calculate total time still remaining, both for holiday hours earn and vacation/sick hours.
Yes, it's easier for me to track it as 8 Hrs rather than 1 day, etc.
Any advice on how to formulate this. Or if anyone knows of a premade template that fits this type of scenario, that I could then just take and integrate into my own spreadsheet.
Sorry if this is confusing in any way.
Also, As I'm no excel wizard, unsure if this is relevant or not, but I'm using Excel 2016, as part of the Office suite.
Another option is to just leave the number as it is and label the column accordingly. Do you really need to see "hrs" in every cell when you know you are tracking hours?
Use a custom number format of,
[>1]0 \H\r\s;[=1]0 \H\r_);0 \H\r\s;[Red]#
... and treat all hours as integers.

Calculate "cell/sum(cells)" script across hundreds of small sets

I'm new here, and would greatly appreciate some help with this problem. I'm trying to take a column (Column H in this case) that's split up by blank rows into a few hundred sets of 21 cells each and find the portion of each cell to that set.
Picture - Objective: Take a cell and divide it against 21 other cells in that set. Skip the blank row and repeat the same process several hundred times.
For example, I want to find out: "In 2015, what portion of Alabama employees were in Management Occupations?" and come to the conclusion that 3.669% were in management (Solution example would be cell [I3]). I want to calculate that for all states across all occupations across all years.
I am currently doing this by typing out what's found in column K to get the solutions found in column I, but that is very laborious and seems inefficient. How would I go about getting solutions found in Column I in the easiest way possible?
Please note that the groups must be broken up by state, which is why there are blank rows between each state.
Thank you very much, and if you need a further explanation of what I'm trying to accomplish, please let me know and I'll respond immediately!
Use SUMIF():
=H3/SUMIF(C:C,C3,H:H)
It will now group the it by the state.
If you want to group it further then use SUMIFS():
=H3/SUMIFS(H:H,C:C,C3,A:A,2015)
This will group it by the state and year 2015.

Resources