How to count entries with specific time range in Excel? - excel

Can anyone help me with this brain teaser :)
I need to count entries by hour and date and as the list is huge formula will save my life.
Bellow is the example how it looks.
Thank you in advance for your help!
17/05/2017 00:40
17/05/2017 01:10
17/05/2017 04:30
17/05/2017 05:00
17/05/2017 05:00
17/05/2017 05:05
17/05/2017 05:15
17/05/2017 05:20
17/05/2017 05:20
17/05/2017 05:30
17/05/2017 05:30
17/05/2017 05:30
17/05/2017 05:40
17/05/2017 05:45
17/05/2017 05:45
17/05/2017 05:50
17/05/2017 06:00
17/05/2017 06:00
17/05/2017 06:00
17/05/2017 06:20
17/05/2017 06:25

To do it with your date and times in one column use:
=SUMPRODUCT((MOD($A$1:$A$21,1)>=C1)*(MOD($A$1:$A$21,1)<=D1))

Edit: If the date and time is in one column, just use DATA --> Text to Columns, and use SPACE as the delimiter to put them in to two columns. There may be other ways to get your answer, keeping the info in one column, but that would likely be a relatively convoluted/complex formula. Text to Columns allows for quicker analysis.
If your data is in two columns, you can use COUNTIFS():
=COUNTIFS($B$1:$B$21,">="&E1,$B$1:$B$21,"<="&F1)

If your data is in one column, then add to the right column the following formula
=REPLACE(REPT(REPT("0",2-LEN(HOUR(A1)))&HOUR(A1),2),3,0,":00 - ")&":55"
and then use pivot table to count each group
enter image description here

Related

How do I merge two rows with the same value but keep all the other column data for both in Excel?

This should be pretty simple I think.
In Excel I've got a list of data I'm gathering from various sources:
name
time 1
time 2
time 3
Time 4
jimmy
00:30
1:30
john
01:09
1:45
bobby
01:09
2:49
elaine
00:39
1:19
greg
01:09
1:45
jimmy
0:33
1:29
bobby
0:45
1:15
elaine
1:24
2:01
jack
0:10
0:50
Desired result:
name
time 1
time 2
time 3
Time 4
jimmy
00:30
1:30
0:33
1:29
john
01:09
1:45
bobby
01:09
2:49
0:45
1:15
elaine
00:39
1:19
1:24
2:01
greg
01:09
1:45
jack
0:10
0:50
I'm either not knowing the proper way to search for this or something because my normally pretty good google-fu is failing me today.
Edit to clarify:
name
time 1
time 2
time 3
Time 4
jimmy
Burger
HotDog
john
Salami
Samosa
bobby
Burger
Paella
elaine
Sorbet
Muffin
greg
HotDog
Wonton
jimmy
Tamale
Waffle
bobby
Paella
Tamale
elaine
Waffle
Toffee
jack
Quinoa
Kiwano
name
time 1
time 2
time 3
Time 4
jimmy
Burger
HotDog
Tamale
Waffle
john
Salami
Samosa
bobby
Burger
Paella
Paella
Tamale
elaine
Sorbet
Muffin
Waffle
Toffee
greg
HotDog
Wonton
jack
Quinoa
Kiwano
Rollback
If you have Excel-365 then use below formulas.
G2 cell =UNIQUE(A2:A10)
H2 cell =#FILTER(B$2:B$10,($A$2:$A$10=$G2)*(B$2:B$10<>""),"")
Drag down and across H2 cell formula as needed.
You can use sumifs formula.
=SUMIFS(B:B,$A:$A,$K2)
for example,
i have kept the unique names in the K column
use sumifs formula for B , C , D , E column
change the format of the cells to time

Excel not recognising all dates in same column

I paste the following in excel, half of them are not recognized as date in excel.
Have already tried text to columns, adding 0 to them. I think exhausted all online techniques.
My target is to convert them all this to this format yyyy-mm-dd hh:mm:ss
9/25/19 19:17
12/5/19 14:28
11/4/19 16:46
3/20/19 14:12
1/2/20 21:15
3/20/19 19:24
3/14/19 20:03
12/29/19 20:24
3/18/19 10:20
3/9/19 11:03
12/16/19 16:01
12/21/19 19:31
12/17/19 11:41
10/12/19 17:09
3/25/19 14:01
11/20/19 21:02
8/28/19 19:00
3/14/19 20:00
3/29/19 1:39
8/30/19 22:04
3/10/19 20:02
11/20/19 8:37
9/15/19 19:19
3/20/19 17:12
8/26/19 11:03
8/30/19 22:16
7/31/19 14:53
3/25/19 20:14
1/26/20 10:24
3/29/19 1:12
6/27/19 10:06
10/15/19 14:05
12/28/19 10:58
10/23/19 13:58
8/25/19 16:07
3/27/19 16:28
3/23/19 11:26
3/24/19 11:13
3/18/19 10:11
3/25/19 13:39
3/26/19 16:35
3/27/19 21:11
11/27/19 13:23
The data sample uses the MDY order. If Excel doesn't recognize half of these as dates, your regional settings use the DMY order.
Instead of pasting the data into Excel, put it into a text file and then open the text file with Excel. That will launch the Text Import Wizard.
Keep Delimited selected and click Next
In Step 2, click Space and click Next. Date and time will now be split into two columns.
In Step 3 of 3, select the first column and click the Date radio button and set the drop-down to MDY.
Click Finish and the data will be in your worksheet as dates.
You can now use formulas to bring the time and date back together by adding the cells, =A1+B1 - and then use formatting to display the date/time values any way you want.

Excel: How to change the date column to display only Month of the date?

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.

Modify values of a CSV based on previous values using awk

I'd like to replace extraneous data values (any value >100,000) of a csv with the previous non-extraneous value.
Input
1/1/2017 01:00 56242
1/1/2017 02:00 51214
1/1/2017 03:00 101442
1/1/2017 04:00 44242
1/1/2017 05:00 990919
1/1/2017 06:00 221512
1/1/2017 07:00 52100
Expected Output
1/1/2017 01:00 56242
1/1/2017 02:00 51214
1/1/2017 03:00 51214
1/1/2017 04:00 44242
1/1/2017 05:00 44242
1/1/2017 06:00 44242
1/1/2017 07:00 52100
Can this be done using awk in a bash script?
Something like:
awk 'BEGIN{FS=OFS=" "} NF{print $1, $2, ($3 >=100000 "not sure") output.csv
Any help would be appreciated - I'm not very familiar with awk.
awk to the rescue!
awk '{if($NF>100000) $NF=p; else p=$NF}1' file

Excel - If time between 2 cells

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)

Resources