How to calculate results and plot data depending on results of a specific column in excel? - excel

I have a .csv file and it contains thousands of rows. I collected this data file as output of running my program for 60 minutes. This output file contains time column (in forum HH:MM:SS:MS), this time column is recording time for my outputs. I want to get plot of my other columns in my output.csv file according to my time column (taking the results for all columns every 1 minutes).
For example:
I have a row like this:
Data Time
----- -----
455 10:00:00
894 10:00:00
785 10:00:00
898 10:00:01
789 10:00:01
748 10:00:02
248 10:00:02
788 10:00:02
148 10:00:02
742 10:00:02
... ...
266 10:01:00
... ...
Is there any easy way to plot other columns with rows according to time column (taking the results for all columns every 1 minutes) ?

While the question is not completely clear/consistent, I understand you want to count the number of data for each of the first 15 intervals
10:00 <= time < 10:01
etc.
For the first interval, you can use
=SUMPRODUCT(($B$2:$B$8>=TIME(10;0;0))*($B$2:$B$10000<TIME(10;1;0)))
I assume your time data is in B2:B10000.
You can expand this range as needed, there is no problem in having an excess range (blank cells will not be counted).
Or you could use
=SUMPRODUCT(($B:$B>=TIME(10;0;0))*($B:$B<TIME(10;1;0)))
You can easily create a column with the start time for each interval, and another column using (a modification of) this formula to for the data count.
Then you would plot the two columns just created.

Related

Count values of an Excel column in different ranges

I want to count number of values in different ranges in an Excel column.
Example 1:
Imagine I have some data in 40 rows, each one happened in different time of day. Like the below image:
now I want to count number of row repeated in different ranges, for example, count number of rows that have time between 12:00 to 18:00, again count 18:00 to 00:00, and more to 11:59 (next 12:00)
Time range
Count
00:00 to 6:00
?
06:00 to 12:00
?
12:00 to 18:00
?
18:00 to 23:59
?
Finally I have a table with 4 rows that shows how many row I have in those ranges and I can create a chart by that.
Example 2:
Count people based on age range. result would be like this:
Age range
Count
12 to 18
3
18 to 25
5
25 to 35
4
35 to 45
1
45 to 60
2
P.S:
I used countif with logical AND, but it didn't work. like this: =COUNTIFS(C:C,"AND(<00:00, >2:00)")
A more correct use of COUNTIFS (which is different from COUNTIF), would be :
'Counts values strictly between 00:00 and 2:00
=COUNTIFS(C:C,">00:00",C:C,"<2:00")
Hope it helps

time in position - excel dates

given the following excel table
I'm trying to add a column with the number of days in a position, my problem is that the 'starting date' for an employee (column b) is the same. This is why I'm struggling with column D creation.
For example: emp 111 the first row is DAYS(B2,C2), but for the second row should be (C2,C3).
I tried to do it with index match array but I can't make it work.
How do I do this kind of calculation?
emp_number
start_working_date
promotion_date
111
2020-01-01
2020-02-04
111
2020-01-01
2020-04-23
111
2020-01-01
2020-08-20
112
2020-03-01
2020-05-01
112
2020-03-01
2020-07-01
113
2020-04-01
2020-08-01
114
2020-05-01
2020-09-01
115
2020-06-01
2020-10-01
Use an IF with MATCH to test if it is the first or not, then subtract from the correct cell:
=IF(MATCH(A2,A:A,0)=ROW(),C2-B2,C2-C1)
Note this only works if the data is sorted correctly. Emp_Number then Promotion_Date.
If the data is not sorted then we can use:
=IF(COUNTIFS(A:A,A2,C:C,"<"&C2)=0,C2-B2,C2-MAXIFS(C:C,A:A,A2,C:C,"<"&C2))
The obligatory discussion on the difference between *IF(s)() and MATCH(). Match is much less intensive on the calcs and as such if it can be done sorting the data and using the first formula will be much more performant.
It will not be noticeable on a dataset of less than a couple thousand. But once the dataset gets above 10,000 the calc times will increase and at some point will fail when using the *IF(s)() function.
You may also try using this, but in your query you have mentioned it wrong since, the syntax of DAYS Function is DAYS(end_date,start_date) where as you have provided as DAYS(start_date,end_date).
• Formula used in cell D2
=IF(COUNTIF($A$2:A2,A2)=1,DAYS(C2,B2),DAYS(C2,C1))

Converting a raw number to a timestamp in Excel

I have a set of numbers ranging from 390 up to 999 in increments of 1. These numbers correspond to timestamps, so 390 corresponds to 6:30am (the 390th minute of the day is 6:30am), 391 corresponds to 6:31am, and so on. Is there a simple formula in excel that could convert these numbers to timestamps for me? I have the first column, Time ID, and I'm wanting to calculate the second column, Time.
Time ID Time
390 6:30:00 AM
391 6:31:00 AM
392 6:30:02 AM
Assuming your data starts in Row 2:
=A2/(24*60)
or
=TIME(0,A2,0)
To force the format, wrap either of the above with TEXT([formula], "hh:mm:ss am/pm")
(Shamelessly stolen from the Great #ScottCraner's comments here)
you can divide by 1440 and then format the cell as time

Reformatting Excel datastructure from multiple rows in columns/rows format

I have the following case: I got data in an format like:
date - timestamp - value where there are 29 values per day, so date stayes the same
What i need is something like:
date 1 per row
timestamp times 29 for each timestamp in a day as columns
values where date and timestamp meets
Is there a way to reformat the structure completely? As the data is pretty big (10 years, 29 data per day) it would take ages to do manually. I need it in the normal excel format as result so i can easily import the data in c#.
What i have:
22.03.2018 08:00 200
22.03.2018 08:30 202
22.03.2018 ...
22.03.2018 22:00 120
23.03.2018 08:00 12
What I want:
08:00 08:30 ... 22:00
22.03.2018 200 202 ... 120
23.03.2018 12
Every help would be appreciated :)
Br

Summing every first month columns in Excel

I am trying to add the sum of the first 7 columns and then the next 7th columns etc in Excel. So for example if I have the below data and I needed to be added weekly,
Day 02/01/2017 03/01/2017 04/01/2017 05/01/2017 06/01/2017 07/01/2017 08/01/2017 09/01/2017 10/01/2017 11/01/2017 12/01/2017 13/01/2017 14/01/2017 15/01/2017
Presented Calls 1000 1550 900 1455 789 987 1435 1200 1675 1230 1232 1400 999 650
So if I want to add the presented calls from 02/01 - 07/01 this should be sum(B2:H2)
Then the sum of the presented calls from 08/01-15/01 this should be sum(I2:M2)
etc
However at the moment in Excel it is being sum(B2:H2) then sum(C2:I2) which is incorrect, can anyone help?
You can use the OFFSET() function combined with the COLUMN() function and a bit of arithmetic to get the desired range to sum.
Try entering this formula and fill across.
=SUM(OFFSET($B$2,0,(COLUMN()-COLUMN($B$2))*7,1,7))

Resources