I need to prepare the student attendance sheet from zoom meeting data file. My data is something like this
Name (Original Name)
roll no.
Join Time
Leave Time
Duration (Minutes)
002-Haseebuddin Shakir
002
22/01/2021 03:42:49 PM
22/01/2021 03:46:34 PM
4
002-Haseebuddin Shakir
002
22/01/2021 03:50:49 PM
22/01/2021 05:31:34 PM
100
003_Abdul Wasay
003
22/01/2021 03:53:51 PM
22/01/2021 04:31:30 PM
98
003_Abdul Wasay
003
22/01/2021 04:35:51 PM
22/01/2021 05:00:30 PM
60
003_Abdul Wasay
003
22/01/2021 05:01:51 PM
22/01/2021 05:31:30 PM
20
004_Ismail (04_Ismail)
004
22/01/2021 03:47:44 PM
22/01/2021 05:31:31 PM
104
005 saud
005
22/01/2021 03:51:07 PM
22/01/2021 05:31:43 PM
101
006-Akber (Akber-006)
006
22/01/2021 03:41:12 PM
22/01/2021 05:05:43 PM
85
I need help to find the 1st joined time, last left time and total of minutes. for understanding purpose used random figures.
I have tried thru pivot table but getting date 1900 whenever I use min/max and even tried aggregate function but I am not that perfect using aggregate.
Looking for output
Name
Roll no
Join time
Last leave time
total no. min's
002-Haseebuddin Shakir
002
22/01/2021 03:42:49 PM
22/01/2021 05:31:34 PM
104
003_Abdul Wasay
003
22/01/2021 03:53:51 PM
22/01/2021 05:00:30 PM
178
I propose a powerquery/powerpivot solution like this -
remove auto filter
select data
from table on get&transform group on Data tab
it will look like this
select name and rollnum both, rightclick group-by. add aggregations like the screenshot
close and load the data back (it will automatically load to a new sheet in same book)
Note I think you'll these aggregations for each of the day for each of the roll number. It is therefore, advised that create a separate column of date before loading the data into powerquery window and thereafter groupby on name rollnum and date columns.
QUESTION
How can I convert 24 hour time to 12 hour time, when the time provided is two characters long? For example: How to format 45 as 12:45 AM.
ATTEMPT
I can get most of the time conversions to format properly with the following:
df=df.assign(newtime=pd.to_datetime(df['Time Occurred'], format='%H%M').dt.strftime("%I:%M %p"))
df.head()
Date Reported Date Occurred Time Occurred newtime
9/13/2010 9/12/2010 45 4:05 AM
8/9/2010 8/9/2010 1515 3:15 PM
1/8/2010 1/7/2010 2005 8:05 PM
1/9/2010 1/6/2010 2100 9:00 PM
1/15/2010 1/15/2010 245 2:45 AM
In the above the values in newtime are properly formatted, except where in the input time is "45" - that time had the result 4:05 AM. Does anyone know how to create the proper output?
to_datetime
times = pd.to_datetime([
f'{h:02d}:{m:02d}:00' for h, m in zip(*df['Time Occurred'].astype(int).__divmod__(100))
])
df.assign(newtime=times.strftime('%I:%M %p'))
Time Occurred newtime
0 45 12:45 AM
1 1515 03:15 PM
2 2005 08:05 PM
3 2100 09:00 PM
4 245 02:45 AM
I have a list of scheduled appointments already and want to be able to show all possible timeslots available between 7:30 AM - 5:00 PM for a 2 hour appointment. I've tried a visual and been able to get it through a hack, but I need to get it to work just from reading the below table
SCHEDULED APPOINTMENTS
|---------------------|-------------------|
| Start Date/Time | End Date/Time |
| 6/12/2019 7:30 AM | 6/12/2019 8:30 AM |
| 6/12/2019 8:45 AM | 6/12/2019 9:15 AM |
| 6/12/2019 3:00 PM | 6/12/2019 3:30 PM |
| 6/12/2019 3:45 PM | 6/12/2019 4:15 PM |
| 6/12/2019 4:15 PM | 6/12/2019 5:00 PM |
|---------------------|-------------------|
EXPECTED OUTCOME:
6/12/2019 9:15 AM
6/12/2019 9:30 AM
6/12/2019 9:45 AM
6/12/2019 10:00 AM
6/12/2019 10:15 AM
6/12/2019 10:30 AM
6/12/2019 10:45 AM
6/12/2019 11:00 AM
6/12/2019 11:15 AM
6/12/2019 11:30 AM
6/12/2019 11:45 AM
6/12/2019 12:00 PM
6/12/2019 12:15 PM
6/12/2019 12:30 PM
6/12/2019 12:45 PM
6/12/2019 1:00 PM
To get just that list directly would require VBA, which is possible, but StackOverflow is not a write-your-code-for you service. We would help if you got stuck with your code, but you need to know how to code in the first place and have made a start.
That said, if you accept a slightly easier solution, then a single formula can give you your desired result:
Convert your appointments range to a data table with column headings "Start" and "End"
Set the table name to "Appointments"
Store your new appointment length (2) in a cell and give it the name "Length"
Create a list of every possible appointment start time, starting from A1
Enter this formula next to the first time in B1, and save it by pressing CTRL+SHIFT+ENTER:
=AND((ROUND(Appointments[Start],4)>=ROUND(A1+Length/24,4))+(ROUND(Appointments[End],4)<=ROUND(A1,4)),ROUND(A1-TRUNC(A1),4)<=ROUND((17-Length)/24,4))
Then fill down that formula against every time slot and it will say TRUE for the available time slots.
For each possible time slot, the formula checks that all existing appointments finish on or before the time slot or start 2 or more hours after the time slot. It also checks that there are at least 2 hours left in the day before finishing at 5pm. The formula handles different lengths required for the new appointment by changing the value in the "length" cell.
The ROUND functions are added to eliminate issues with floating point precision on fractions/times not always correctly identifying when 2 times are the same.
Epoch time for 2nd July 2018 , 11 PM. (IST)
> moment('2018-07-02T23:00:00.000').unix()
1530552600
Now When I convert from epoch to IST, It added 7 minute Extra.
> moment.unix(1530552600).tz("Asia/Kolkata").format("DD:MM:YYYY HH:MM z");
'02:07:2018 23:07 IST'
When converted to ET timezone , It gives 30 minute less from IST timezone. ET is 9.5 behind IST so it should have been "02:07:2018 01:30:00 EDT'
> moment.unix(1530552600).tz("America/New_York").format("DD:MM:YYYY HH:MM z");
'02:07:2018 13:07 EDT'
IST
your formatting string is wrong, you used MM (month) instead of mm (minutes)
try
moment.unix(1530552600).tz("Asia/Kolkata").format("DD:MM:YYYY HH:mm z");
for all other formats see the moment documentation
I'm trying to understand length of an outage that occurs within time range.
In once cell I have the support period: Level 1 Monday-Saturday 0800-1800
In two other cells I have the start time and end time of the outage
Example:
Outage Start: Wednesday, 24 August 2016 16:47
Outage End: Monday, 29 August 2016 10:15
Result should return: 33:28 hours
Workings:
Wednesday, 24 August 2016 16:47 - 18:00 = + 01:13
Thursday , 25 August 2016 08:00 - 18:00 = + 10:00
Friday , 26 August 2016 08:00 - 18:00 = + 10:00
Saturday , 27 August 2016 08:00 - 18:00 = + 10:00
Monday , 29 August 2016 08:00 - 10:15 = + 02:15
Any advice appreciated!
Updated
Please check the above image, I hope you want something similar to this.
Enter the following formula in the column C2
=INT(IF(DAYS(B2,A2)=0,IF(TEXT(A2,"ddd")="Sun",0,ROUND((B2-A2)/(1/24/60),0)
),IF(DAYS(B2,A2)=1,IF(TEXT(A2,"ddd")="Sun",0,(DATE(YEAR(A2),MONTH(A2),DAY(A2))+1/24*18)-A2
)/(1/24/60) +
IF(TEXT(B2,"ddd")="Sun",0,B2-(DATE(YEAR(B2),MONTH(B2),DAY(B2))+1/24*8)
)/(1/24/60),IF(TEXT(A2,"ddd")="Sun",0,(DATE(YEAR(A2),MONTH(A2),DAY(A2))+1/24*18)-A2
)/(1/24/60) +
IF(TEXT(B2,"ddd")="Sun",0,B2-(DATE(YEAR(B2),MONTH(B2),DAY(B2))+1/24*8)
)/(1/24/60) +
(IF(DAYS((DATE(YEAR(B2-1),MONTH(B2-1),DAY(B2-1))),A2)<0,0,DAYS((DATE(YEAR(B2-1),MONTH(B2-1),DAY(B2-1))),A2))-
INT(((DATE(YEAR(B2-1),MONTH(B2-1),DAY(B2-1)))-(DATE(YEAR(A2),MONTH(A2),DAY(A2)) + MOD(DATE(YEAR(A2),MONTH(A2),DAY(A2)),7)))/7+1)) * 10 * 60
)
))
Enter the following formula in the cell D2
=INT(C2/60) &":" & INT(MOD(C2,60)+0.5)
Then copy the C2 and D2 to all the cells that you want, it will give the outage value that you are looking for.
For example if cell A2 contains the Outage Start date Wednesday, 24 August 2016 16:47 and cell B2 contains the Outage End date Monday, 29 August 2016 10:15, then you can use the following:
=DAY(B2-A2)
This will return 4 days.
=HOUR(B2-A2)
Will return 17 hours
=MINUTE(B2-A2)
Will return 28 minutes.
Then you could use the following:
="The outage lasted for "& DAY(B2-A2) & " days, " & HOUR(B2-A2) & " hours, and " & MINUTE(B2-A2) & " minutes."
To produce this:
The outage lasted for 4 days, 17 hours, and 28 minutes.