EXCEL - 1st row example; clocked IN at 08:20 - clocked OUT at 17:03
What I want to do is basically in 8:00-8:59 - if row 1 was between them times then output a 1, if not, then output a 0
Any help is greatly appreciated
Assuming 08:00-08:59 is in cell J1, then you can put this formula into J2:
=IF(AND($A2>=VALUE(LEFT(J$1,FIND("-",J$1)-1)),$A2<=VALUE(RIGHT(J$1,LEN(J$1)-FIND("-",J$1)))),1,0)
Storing the time parameters as text forces the use of the VALUE function. Shifting everything down a row and putting the start of the hour in row 1 and the end of the hour in row 2 so it looks like this:
08:00 09:00 10:00 11:00 12:00
Clock1 C1 Clock2 C2 Clock3 C3 Clock4 C4 08:59 09:59 10:59 11:59 12:59
08:20 I 17:03 X
10:20 I 16:03 X
08:00 I 18:00 O
10:11 I 17:00 O
Would change the formula to:
=IF(AND($A3>=J$1,$A3<=J$2),1,0)
Related
I'm working on generating a report by month and I'm going to create Graph based on the month values.
Consider I'm having 1000+ records in my excel sheet and there is a column called created_date which is containing the values like 11/1/2019 1:34:00 AM. I'm looking for a function or any solution to convert the created_date value to 11 or 11/2019 so I can generate a chart by Month.
Note: I'm using the online version of Microsoft Excel for this operation.
For Example - I have attached some records below.
Created_date
11/1/2019 1:34
11/1/2019 0:10
10/31/2019 19:31
10/31/2019 8:32
10/31/2019 3:59
10/31/2019 0:06
10/29/2019 23:48
10/29/2019 23:37
10/29/2019 22:35
10/29/2019 22:33
10/29/2019 22:26
10/29/2019 19:15
10/25/2019 20:44
10/25/2019 3:36
10/5/2019 3:25
10/5/2019 1:52
10/3/2019 0:40
10/2/2019 19:23
10/1/2019 3:56
9/27/2019 4:23
9/27/2019 0:19
9/25/2019 0:46
9/24/2019 22:22
9/24/2019 22:20
9/24/2019 17:12
9/20/2019 20:21
Assume your data is in cell A1, input the formula into cell B1 =TEXT(A1,"mm/yyyy"). This wil give you output of 11/2019. If you only want a 2 digit month, change the formula to =TEXT(A1,"mm"). You can then reference your chart to this new column.
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.
Please could anyone kindly help. Thanking you in advance. My problem is as the following:
I have thousands lines of data with two clusters of time. One is in sheet1, for example, random times from 16pm to 20pm or 4 hours or 240 minutes, I would like to give value to them i.e. 1 to 241
(column B)
A B
17:19
17:19
17:19
18:06
18:06
18:06
16:30
16:30
16:30
I have a second sheet which will give values to sheet1 column B, the content of sheet2 is:
16:00 1
16:01 2
16:02 3
.
.
.
17:19 80
17:20 81
17:21 82
.
.
.
18:06 127
18:07 128
18:08 129
.
.
.
16:30 31
16:31 32
16:32 33
.
.
.
19:58 239
19:59 240
20:00 241
I tried to use VLOOKUP, hour, minute to get values for sheet1 B, using sheet2 but I am still unsuccessful (I kept getting false value from comparing two columns containing times) e.g. in sheet1 column B, say B2 I have
=IFERROR(VLOOKUP($B2,'sheet2'!$A:$B,2,FALSE),"")
My solution did not work. if possible I should get sheet1 filled in like
A B
17:19 80
17:19 80
17:19 80
18:06 127
18:06 127
18:06 127
16:30 31
16:30 31
16:30 31
You can use an excel formula like this:
B2: =(HOUR(A2)*60)+MINUTE(A2)+1
This is just calculating the number of minutes after midnight. If you wanted to start at say, 16:00, you would just modify it like this:
Set a value somewhere that is the START time... In this example I have "$E$4" set to 16:00
=(HOUR(A3-$E$4)*60)+MINUTE(A3)+1
You could put your start time on another sheet or anywhere.
Of course you can always add the If statement to deal with empty rows:
=IF(A2="","",(HOUR(A3-$E$4)*60)+MINUTE(A3)+1)
In the example, note in the screenshot in column A, the formatting is TIME for row 2, and General for rows 3 & 4. The formula will work for either.
edit:added IF statement & description of screenshot.
EDIT AFTER COMMENT: Modified formula to add 1 minute.
I finally, found a correct answer
=(HOUR(A2)-16)*60+MINUTE(A2)+1
so 16:00 will give 1, 16:30 will give 31, 17:19 will give 80 and so on, 20:00 will give 241.
Thanks for trying to help, PJ Rosenburg. Indeed I was on right track in using hour and minute, BUT I do not even need to use VLOOKUP.
I have data as below:
amos 50 10/16/2012 10:13
amri 50 1/9/2013 9:31
andi 10 3/11/2008 10:35
andik 10 12/6/2012 16:58
anggoro 50 9/13/2012 16:14
ari_prabowo 50 11/26/2012 10:30
astra_permana 10 8/2/2010 17:40
atang 10 1/16/2009 14:39
I want to counting how many times such like year of "2008", "2009", "2010", "2012", "2013" occurred.
Thanks for re-formatting your data.
I would add a helper column to calculate the year
=YEAR($A$1)
Then you can use a countif on that column
=COUNTIF($B$1:$B$10,2008)
Otherwise you could use a sumproduct (Excel 2003)
=SUMPRODUCT(($A$1:$A$10>=DATE(2008,1,1))*($A$1:$A$10<DATE(2009,1,1)))
Or countifs (excel 2007 +)
=COUNTIFS($A$1:$A$10,">=1/1/08",$A$1:$A$10,"<1/1/09")
I have an Excel 2007 spreadsheet with date entries in this format m/d/yyyy h:mm (one cell). I would like find the hourly and daily average of all the columns of this spreadsheet and save each time aggregation to a new worksheet.
The data is recorded every ~10 minutes, but throughout the dates of data collection there was some time slips. Not every hour has the same number of rows. Also, the ending minute is either 0 or 6 depending on the time correction.
What would be a good way to approach this task within Excel 2007? It seems like this might be possible with a pivot table if I can create a formula that will select the correct range for the timestamps. Thanks.
For example, an date time entry in TIMESTAMP, 10/31/2012 0:06 which is in one cell.
TIMESTAMP Month Day Year Hour Min Rain_mm Rain_mm_2 AirTC AirTC_2 FuelM FuelM_2 VW ... there are ~16 variables (total) after the data time
10/31/2012 0:06 10 31 2012 0 06 0 0 26.11 26.08 2.545 6.4 0.049
10/31/2012 0:16 10 31 2012 0 16 0 0 25.98 25.97 2.624 6.6 0.049
10/31/2012 0:26 10 31 2012 0 26 0 0 24.32 23.33 2.543 6.5 0.048
10/31/2012 0:36 10 31 2012 0 36 0 0 24.32 23.33 2.543 6.5 0.048
10/31/2012 0:46 10 31 2012 0 46 0 0 24.32 23.33 2.543 6.5 0.048
10/31/2012 0:56 10 31 2012 0 56 0 0 25.87 25.87 2.753 7.3 0.049
10/31/2012 1:06 10 31 2012 0 06 0 0 25.74 25.74 2.879 8.1 0.051
## The above is just over one hour of collection on one day ##
...
## Different Day ### Notice Missing Time Stamp
11/30/2012 0:00 11 30 2012 0 06 0 0.1 26.12 26.18 2.535 6.4 0.049
11/30/2012 0:10 11 30 2012 0 16 0 0.1 25.90 25.77 2.424 6.6 0.049
11/30/2012 0:20 11 30 2012 0 26 0.1 0.2 24.12 24.43 2.542 6.4 0.046
11/30/2012 0:30 11 30 2012 0 36 0.1 0 24.22 22.32 2.543 6.5 0.048
11/30/2012 0:50 11 30 2012 0 56 0.1 0.2 26.77 25.87 2.743 6.3 0.049
11/30/2012 1:00 11 30 2012 0 06 0 0 24.34 24.77 2.459 5.1 0.050
## so forth on so on ##
After clarification of the requirement for daily averages edited to cover both daily and hourly averages:
Add a column (here B) for ‘H’ (ie hour) with =HOUR(A2) copied down.
(Note: Though formatted to show only m/d/y content of ColumnA is, in line with title, assumed to be all of mm/dd/yyyy hh:mm. Makes existing columns [with names jumbled] Month, Day, Year, Hour redundant).
Select data range.
Data, Subtotal, At each change in: TIMESTAMP, Use function: Average, Add subtotal to: check only columns G and to the right, OK.
Uncheck Replace current subtotals in Subtotal and apply At each change in: H, Use function: Average, and Add subtotal to: as before, OK.
Replace =SUBTOTAL(1, in Min column with =MIN( .
Delete ‘spare’ Grand Average row.
Reformat as required.
Hopefully this will be achieved and is what is required!:
Note midnight 'tonight' is counted as within first hour of tomorrow.
I had a similar need and worked it out this way:
Add a column for Date (assuming your dd/mm/yyyy hh:mm:ss data is in cell A2)
=DATE(YEAR(A2),MONTH(A2),DAY(A2))
Add a column for Year. If you have weeks from a single year, the year column can be neglected.
=YEAR(A2)
Add a column for Week Number
=WEEKNUM(A2)
Add 2 pivot tables, 1 for daily and 1 for weekly analysis.
Choose fields "Date" and the quantities you want. Put "Date" in the Rows section and sum/average of values in the Values section. You will get a date wise sum/average of the values you need.
In the weekly pivot table, do the same as above, just add "Year" and "Week no" in the Rows section instead of "Dates" as in above.
Hope this helps