I need to fill in dates corresponding to time. I just need something that increments the date when the time changes from 23 to 0. Here is what my sheet looks like:
5/1/2017 23:00
5/1/2017 23:00
5/1/2017 23:00
? 0:00
? 0:00
? 0:00
I've tried these with different formats for the time column:
IF(AND(B4=0,B3=23),A3+1,A3)
IF(AND(B4="1/0/1900 12:00:00 AM",B3="1/0/1900 11:00:00 PM"),A3+1,A3)
IF(AND(B4="12:00:00 AM",B3="11:00:00 PM"),A3+1,A3)
Your first formula looks correct but you can see where it's wrong if you type =B3=23 into a cell (it's FALSE). Instead, try B3=23/24: =IF(AND(B4=0,B3=23/24),A3+1,A3).
A B
1 5/1/2017 11:00:00 PM
2 XXX 12:00:00 AM
Where XXX is = IF(ABS(B1-23/24)<0.001,IF(ABS(B2-24/24)<0.001,A1+1,A1),A1)
what we do here is a nested if statement, basically saying if A and B
where A is "time in cell above is near 11 pm"
and B is "time in cell is near zero"
the way date/times work in excel is that the fractional portion corresponds to time after midnight. So 1/24 ~ .041667 is an hour past midnight, and 23/24 is 11 pm
Related
A B
Departure Date Arrival date
4/9/18 22:40 5/17/18 14:10
8/5/18 18:20 8/22/18 6:00
9/24/18 22:20 10/10/18 6:00
10/22/18 14:00 11/7/18 6:10
12/3/18 22:25 12/19/18 6:00
1/16/19 0:00 1/30/19 0:00
I need some help please. I have to calculate the total travel days for our employees for a specific period of time. I have columns A and B (all are date and time). Column A is the Departure Date, Column B is the Arrival Date.
Question: which is the Total number of travel days between:5/10/2018 and 12/10/2018?
Try this, you may need to edit it to match your needs though...
IF(AND(A4>=$A$1,B4<=$B$1),B4-A4,IF(AND(A4<=A$1,B4<=$B$1),B4-$A$1,IF(AND(A4>=A$1,B4>=$B$1),$B$1-A4)))
See:
I’m trying to create either a spreadsheet or macro that allows me to put and employee start and finish time in and then show me by each half hour how many half hours they are in.
For example;
Employee 1 - 08:30 to 10:15
The output I would want is;
08:00 0
08:30 1
09:00 1
09:30 1
10:00 0.5
10:30 0
11:00 0
So between 8:30 and 9:00 shows as one because that employee was in during that half hour. But between 10:00 and 10:30 it shows 0.5 because the employee was only in for half of that period
Then as I add more data it tells me which half hours they are covering.
I’ve tried using the ceiling and floor values, counta, countif, countifs, v and hlookups but just can’t get the desired effect.
I’m guessing it would need to be a macro.
Assuming C1 and D1 contain the start and end times of a shift and column A contains the times, use the following formula in column B:
=IF(A2>D$1,C2,IF(AND(A2>=C$1,A3<=D$1),1,MAX(0,A3-D$1)/(1/48)))
Limitations: shifts cannot cross over days, days cannot start before 00:00 or end after 23:59
I am using Excel 2010, and have access to PowerPivot.
I am trying to find out how to work out the time each subset lasted.
Here is an example of the data:
Run: Date: Time:
A 31/01/2018 20:00:00
A 31/01/2018 21:00:00
A 31/01/2018 22:00:00
A 31/01/2018 23:00:00
A 01/02/2018 00:00:00
A 01/02/2018 01:00:00
B 04/02/2018 10:00:00
B 04/02/2018 11:00:00
etc.
I want to find out the length of time between the first row and the last row in each different subset, so that the output will be:
Run: Time Taken:
A 05:00:00
B 01:00:00
TIA,
Teuthis
I've managed to answer the question myself, for anyone who has the same issue. Here is a picture of the solved spreadsheet, with the formula in red.
Spreadsheet inc solution
The formula is:
=(LOOKUP(A15,$A$2:$A$9,($B$2:$B$9+$C$2:$C$9)))-((INDEX($B$2:$B$9,MATCH(A15,$A$2:$A$9,0)))+INDEX($C$2:$C$9,MATCH(A15,$A$2:$A$9,0)))
=(LOOKUP(search term,array to search,(date to search in+time to search in)))-((INDEX(date to search in,MATCH(search term,array to search,0)))+INDEX(time to search in,MATCH(search term,array to search,0)))
NOTE:
You will need to make sure that the times are all in hh:mm and not dd/mm/yy hh:mm, otherwise the ones close to midnight will be incorrect.
Excel 2016 (office 365, current version)
I have a formula that works, but is manually intensive (i.e. manually edit the date in two places for each formula, and I have to do this for an entire quarter's worth of data):
=SUMIFS('Raw'!$E:$E,'Raw'!$A:$A,">=3/30/2017 0:00",'Raw'!$A:$A,"<=3/30/2017 23:00")
yields: 35.69658611 (Correct, actual sample data below)
I would like to be able to take the date value for the local sheet column M (list of dates for the month) and plug that date directly into the formula so I can copy paste the formula to calculate the rest of the month.
What I have returns a value of zero:
=SUMIFS('Raw'!$E:$E,'Raw'!$A:$A,">="&M3 &" 0:00",'Raw'!$A:$A,"<="&M3 &" 23:00")
DataTable: Raw
Date/Time value: 'Raw' column A
Data to sum: 'Raw' Column E
Both formulas are based on hint from https://www.mrexcel.com/forum/excel-questions/601474-sumifs-date-range-criteria.html
Sample data:
DateTime kW
3/30/17 23:00 0
3/30/17 22:00 0
3/30/17 21:00 0
3/30/17 20:00 0
3/30/17 19:00 0.004455278
3/30/17 18:00 0.5370675
3/30/17 17:00 2.303020833
3/30/17 16:00 4.122186389
3/30/17 15:00 5.415064722
3/30/17 14:00 6.190184167
3/30/17 13:00 3.621349167
3/30/17 12:00 3.292333056
3/30/17 11:00 4.470871944
3/30/17 10:00 2.407315556
3/30/17 9:00 2.269564167
3/30/17 8:00 1.033854722
3/30/17 7:00 0.029317778
3/30/17 6:00 0
3/30/17 5:00 0.000000556
3/30/17 4:00 0
3/30/17 3:00 0
3/30/17 2:00 0
3/30/17 1:00 0.000000278
3/30/17 0:00 0
You must remember how the date format work in Excel.
Every day since 1900/01/00 (arbitrary chosen date) are indexed.
So in short, when you type 2017/03/30 in cell M3 excel really only read "42824".
=SUMIFS('Raw'!$E:$E,'Raw'!$A:$A,">="&$M3 &" 0:00",'Raw'!$A:$A,"<="&$M3 &" 23:00")
Only change required is that you must save date in Text format (i.e, prepend an apostrophe (') to the date, thereby not allowing excel to auto-format as Date).
The final working formula was almost exactly the same as my second one, the only change really was the added $ to lock in the column on the textual concatenation:
=SUMIFS('Raw'!$E:$E,'Raw'!$A:$A,">="&$M3 &" 0:00",'Raw'!$A:$A,"<="&$M3 &" 23:00")
Only change required is that you Must save date in Text format (i.e, prepend an apostrophe (') to the date, thereby not allowing excel to auto-format as Date)
Special thanks to #MrDogme for the trigger that helped me fix the problem.
I have one column with the time in format "dd/mm/yyyy hh:mm" and another with the temperature for that time point. I am looking to calculate the average temperature of the day and night of each month separately. I.e. average all temperatures between 06:00 and 18:00 in May and all temperature between 18:00 and 06:00 in May and then the same for March and so on.
Time Celsius(C)
06/05/2016 10:49 28
06/05/2016 11:49 29
06/05/2016 12:49 31
06/05/2016 13:49 27.5
06/05/2016 14:49 24
06/05/2016 15:49 25
06/05/2016 16:49 24.5
06/05/2016 17:49 23.5
06/05/2016 18:49 23
06/05/2016 19:49 22.5
06/05/2016 20:49 22.5
I am currently using the following formula:
=AVERAGEIFS(C2:C3643,B2:B3643,">=01/05/2016",B2:B3643,"<=31/05/2016",B2:B3643,">=01/05/2016 06:00",B2:B3643,"<=31/05/2016 18:00")
To try and calculate an average if the date is within May and during the day - however it doesn't appear to be working and when I change the hour periods it still spits out the same number (which is the average for the month).
You can use a long SUMPRODUCT Formula:
For the 600 to 1800 in May:
=SUMPRODUCT(($A$2:$A$12>=DATE(2016,5,1))*($A$2:$A$12<=DATE(2016,5,31))*(MOD($A$2:$A$12,1)>=TIME(6,0,0))*(MOD($A$2:$A$12,1)<=TIME(18,0,0))*B2:B12)/SUMPRODUCT(($A$2:$A$12>=DATE(2016,5,1))*($A$2:$A$12<=DATE(2016,5,31))*(MOD($A$2:$A$12,1)>=TIME(6,0,0))*(MOD($A$2:$A$12,1)<=TIME(18,0,0)))
You can always replace all the DATE() and TIME() parts with cell references instead of hard coding them.
To get the between 1800 and 600 we need to shift it to an OR with + between the Time Boolean instead of *:
=SUMPRODUCT(($A$2:$A$12>=DATE(2016,5,1))*($A$2:$A$12<=DATE(2016,5,31))*((MOD($A$2:$A$12,1)<=TIME(6,0,0))+(MOD($A$2:$A$12,1)>=TIME(18,0,0)))*B2:B12)/SUMPRODUCT(($A$2:$A$12>=DATE(2016,5,1))*($A$2:$A$12<=DATE(2016,5,31))*((MOD($A$2:$A$12,1)<=TIME(6,0,0))+(MOD($A$2:$A$12,1)>=TIME(18,0,0))))
This relies on you creating a table of months and time ranges like below:
Enter this formula in E2 and drag around as needed. It's an array formula, so must be entered with Ctrl-Shift-Enter:
=AVERAGE(IF(
((MONTH($A$2:$A$101)=MONTH(E$1&1))*
((MOD(HOUR($A$2:$A$101)-LEFT($D2,2),24))>=0)*
((MOD(HOUR($A$2:$A$101)-LEFT($D2,2),24))<12)),
$B$2:$B$101))
Notes:
The MONTH(E$1&1) part lets you get a month number from text like
"Jan"
I used MOD and subtraction of the left part of the time range to get
the target hour in a range from 0 to 23. This made it possible to filter on values between 1 and 11.
If Barry Houdini were still around he could do it in half the space, I'm sure.
While working with datetime and when the actual day is reckoned beyond midnight like in 18 hrs to 6 hrs the next day, I find it useful to offset the time back and do the calculations.
6:00 to 18:00 =AVERAGE(IF((MONTH($A$2:$A$12-0.25)=D2)*(MOD($A$2:$A$12-0.25,1)<0.5),$B$2:$B$12,""))
18:00 to 6:00 =AVERAGE(IF((MONTH($A$2:$A$12-0.25)=D2)*(MOD($A$2:$A$12-0.25,1)>=0.5),$B$2:$B$12,""))
These are array formulas entered with Ctrl-Shift-Enter.
Here I am offsetting time by 0.25 days which is 6 hours.