Hello I have to count how many people were scheduled on each hour in excel so I transformed starting and ending data/time to only contain time and basing on it I tried to substract these two information but I only get an hour then but what I need is the hours to be like this:
instead
starting on 9:00
ending on 17:00
this
9:00
10:00
11:00
12:00
13:00
14:00
15:00
16:00
17:00
to count every hour that employee was at work. But I don't know how :(
Or is there a better way of doing that?
Assuming your table looks something like this:
Person
Start
End
09:00
10:00
11:00
12:00
13:00
14:00
15:00
Alice
08:35
16:35
1
1
1
1
1
1
1
Bob
09:35
17:35
0
1
1
1
1
1
1
Carl
10:35
18:35
0
0
1
1
1
1
1
Dan
11:35
19:35
0
0
0
1
1
1
1
Ed
12:35
20:35
0
0
0
0
1
1
1
Total present
1
2
3
4
5
5
5
You can compute the entries 0 or 1 in each cell under the times using the formula
=IF(AND((E$4>$C6);(E$4<=$D6));1;0)
In the formula, E$4 is a reference to the column header, e.g. "9:00", $C6 and $D6 are references to the start and end times of the person. They are defined using partial absolute references ($) so the same formula can be copied and pasted in all the cells.
The result will be 1 if the person was present at that time and 0 if not.
The "Total present" formulas just sum up the 1's and 0's in the column.
Related
I have a data as below. I have created column "difference in values" manually, the calculation is value at 8:15 AM - value at 8:00 AM which is 2 in second row and so on for all values of column Tushar and Lohit respectively. How can i do this calculation in Spotfire i believe over and previous function can help but i am unable find anything on this. Please help
Name Time Values Difference in values
Tushar 08:00 AM 2 0
Tushar 08:15 AM 4 2
Tushar 08:30 AM 5 1
Tushar 08:45 AM 6 1
Tushar 09:00 AM 7 1
Lohit 08:00 AM 2 0
Lohit 08:15 AM 4 2
Lohit 08:30 AM 5 1
Lohit 08:45 AM 6 1
This should work
SN([Values] - Max([Values]) over (Intersect(Previous([Time]),[Name])),0)
where Max(..) is just to have an aggregation, since it is only looking at the previous Time row for each value of Name. [so Min would work just as well].
SN(...) is there to set the result to 0 when it is empty (as in the first row of each Name).
i want to add +2 days to column based on other column i use this table :
Company Type Joinning Date Starting day
1 1 19/01/2019
2 0 19/01/2019
3 0 19/01/2019
4 1 20/01/2019
5 0 20/01/2019
6 1 21/01/2019
i want to add +2 DAYS in column Starting day which is Joining day + 2 days if the company have type 1 how can i do it ?
What i've tried ?
pic
Desired Results
Company Type Joinning Date Starting day
1 1 19/01/2019 21/01/2019
2 0 19/01/2019
3 0 19/01/2019
4 1 20/01/2019 22/01/2019
5 0 20/01/2019
6 1 21/01/2019 23/01/2019
Just to show my comment of:
=IF(B2=1,C2+2,"")
Works. The output cell must be formatted in the desired method:
I cannot get too specific due to my company regulations, so I will attempt to provide as much info as I can.
I have a for loop that goes through a list of names. In the loop, I have another loop that determines if a certain value should be assigned to to another list using the Name. Here is an Example
John Doe is number one on my list.
Jane Doe is number two.
John Doe
17:20 = 1
17:25 = 2
17:40 = 1
17:45 = 0
19:00 = 1
19:10 = 0
19:30 = 1
19:50 = 0
The Values are assigned based off of something that occurs during those times.
If X happens, Add 1 to the value.
If Z happens, subtract 1 from the value.
This will repeat for Jane Doe once the last row for John Doe is hit
(Everything above this I have already programed)
Where I am stuck, is I need to be able to have excel Subtract the time with the value of 0, from the time with the value of 1
For Example
17:00 = 1
17:10 = 2
17:20 = 3
17:30 = 4
17:35 = 3
17:40 = 2
17:50 = 1
18:00 = 0
I need excel to be able to subtract 17:00 from 18:00 based off of the value on the right.
I.e
If Range(B & [Whatever row]).Value = to 0 And Range(A & [Whatever row]).Value = 1 then
subtract Range(A & [Whatever row]) from Range(A & [Whatever row])
But the problem is when I doe this, it will subtract 17:50 from 18:00 due to it falling in the same circumstance.
I fixed this through having ten different If else if circumstances, but I do not want to keep it that messy.
Does anyone have any other options?
I am fairly new to coding, so I am not too sure if there is anything else I can do other than that
I Have a dataset with fields id, time, date, name, etc. I want to extract data that has the same id and date. How can I do that?
For example
id time date
1 16:00 03/05/2020
2 16:00 03/05/2020
1 17:00 03/05/2020
1 16:00 04/05/2020
2 16:00 04/05/2020
Now I want to fetch :
1 16:00 03/05/2020
1 17:00 03/05/2020
Can groupby and filter
df.groupby(['id', 'date']).filter(lambda s: len(s) > 1)
id time date
0 1 16:00 03/05/2020
2 1 17:00 03/05/2020
So say I had a table like this that has the score of 3 different teams for the week.
Day Team1 Team2 Team3
Mon 5 2 2
Tue 0 7 7
Wed 6 3 2
Thu 0 0 1
Fri 13 6 5
I want a formula that can find the highest score for the day and mark it on a identical table with a value of 1 and mark the other teams 0.
If there are 2 values that are the highest I want them to both be marked 1.
There will never be day with all 0's
Using the data from the table above my other table would look like this.
Day Team1 Team2 Team3
Mon 1 0 0
Tue 0 1 1
Wed 1 0 0
Thu 0 0 1
Fri 1 0 0
I have a working formula
=IF(AND(B2>=$C2,B2>=$D2,B2>=$E2),1,0)
I was just hoping there was a better way to write this formula, so that I can drag it across the teams and have it still work.
If I try to drag my formula now. I have to update the formula for each column. Sometimes I might have 20 + teams.
Any advice is appreciated.
Use MAX():
=IF(B2=MAX($B2:$D2),1,0)
Then copy/drag over and down.