EXCEL Max value for multple time/date intervals - excel

I have an excel file as per the image attached
The date range in column D spans several days ie. there is also data for 10/08/2016; 10/09/2016, ect...
I am trying to get the maximum value in columnC for each 15 minute interval in column D.
eg:
10/08/2016 00:00 - 00:15 -- 0
10/08/2016 00:16 - 00:30 -- 25
10/08/2016 00:31 - 00:45 -- 13
and so forth until the end of the file.
Any help is appreciated.

First you need to get the 15 minute intervals. To do this, I put the Date/Time Start values in column F starting in F2 (I assumed row 1 is a header row). In cell F2 is this formula: =FLOOR(MIN(D:D),15/1440) and in cell F3 and copied down is this formula: =IF(F2="","",IF(F2+TIME(0,15,0)>MAX(D:D),"",F2+TIME(0,15,0)))
Then I put Date/Time End values in column G starting in G2 (because row 1 is a header row). In cell G2 and copied down is this formula: =IF(F2="","",F2+TIME(0,15,0))
Now you can get your maximum per interval. To do this, I put Max Interval Value results in column H starting in H2 using this formula copied down: =IF(F2="","",MAX(INDEX(($D$2:$D$11001>=F2)*($D$2:$D$11001<G2)*$C$2:$C$11001,)))
Adjust columns to suit your needs, and adjust the ranges ($D$2:$D$11001 and $C$2:$C$11001) to suit your actual data.

Related

Sum the values of a cell in Excel or change to a different expression of that value in another cell

I have a cell of a worksheet with a value of
1h 25m
entered with the cell (got it from a Jira import). I am trying to figure out how to populate another cell on the same row with a purely numerical version of this cell value, i.e.
85
This is so that I can run SUMIF statements to get the total amounts of minutes for a given person, on a given day.
As in the provided image, I want the sum total amount of Log Work (Column C) for Matthew R. on the 17th of October.
Here, we're creating two helper columns. You could combine everything, but thought this may be easier to illustrate.
Value
hours
minutes
sum
5m
0
5
5
1h 35m
1
35
95
3h
3
0
180
4h 55m
4
55
295
12h
12
0
720
Column A (Value) is your original value.
Column B (hours) is the following formula, which finds the letter "h" and returns everything to the left of it. If H is not found then return a 0.
=IFERROR(LEFT(A2,FIND("h",A2)-1),0)
Column C (minutes) is the following formula, which returns everything to the right of "h" and then removes "m" and trims it. But if "m" is not found then return a 0.
=IF(ISNUMBER(SEARCH("m",A2)),TRIM(SUBSTITUTE(IFERROR(RIGHT(A2,LEN(A2)-FIND("h",A2)),A2),"m","")),0)
Lastly, column D simply calculates total minutes as:
=(B2*60)+C2
You can probably shorten column C's formula, but this at least provides you an interim solution.

If there a function to count a cell if it’s blank or non- blank based on if it’s located with in cellls in a date range?

Criteria I need my formula based on:
A
B
C
1
7/3/2021
2
7/5/2021
3
July 1,2021
775
4
July 2,2021
788
5
July 3,2021
73738
6
July 4,2021
73738
7
July 5,2021
73738
if the column c is blank or has a number in it (doesn’t matter what number)
if the cell c corresponds with cell b if it is in between the dates in B1 & B2
so essentially there would be 3 cells counted in this instance
What I am doing is in column B i’m entering in all the days in the month. Then in B1(admission date) B2 ( discharge date) , In c I will write a value .
I want the formula to count the cells(C:C) (both blank and non blank) between admission date and discharge date that the patient was admitted for .
The function below counts the number of entries between B1 and B2 whether they are blank or not.
=COUNTIFS(B3:B7,">="&B1,B3:B7,"<="&B2)
The formula will return 3 for your example. Your question doesn't clarify how blank cells affect this count but more conditions could be added to it.

Is there a way to calculate a ratio using SUMIFs?

I am trying to get cell I13 on sheet MONTHLY STATS - SPREADS to populate a 0 if there have been no L's to count between the dates of 1 Oct 21 and 31 Oct 21 on sheet SPREADS LOG.
But I only want this 0 to populate if there is data present in cell H13. If there is no data in H13I would like I13 to be blank. (note I cannot use a number format to hide these 0's in cell I13 as I am trying to average the complete I column )
Whilst it is doing this cell I13 must also be able to run the COUNTIFS & SUM formulas shown below.
This is the current formula in cell I13 :
=IF(SUM(COUNTIFS('SPREADS LOG'!P:P,{"L"},'SPREADS LOG'!R:R,">="&DATE(2021,10,1),'SPREADS LOG'!R:R,"<="&DATE(2021,10,31)))=0,"",SUM(COUNTIFS('SPREADS LOG'!P:P,{"L"},'SPREADS LOG'!R:R,">="&DATE(2021,10,1),'SPREADS LOG'!R:R,"<="&DATE(2021,10,31))))
If someone could tweak this formula, that would be great.

Transforming Date data from one column to several 24row columns

I have data output into one column by hour of day. I was wondering if there was any way to take that data from the one column, and spread it across multiple columns in 24 hour segments.
For example this is my data now:
Time 1st Day views
12:00AM 3
1:00AM 43
2:00AM 0
... ...
11:00PM 5
12:00AM 4
1:00AM 10
2:00AM 0
... ...
11:00PM 15
I want it to look like this:
Time 1st Day views 2nd Day Views
12:00AM 3 4
1:00AM 43 10
2:00AM 0 0
... ... ...
11:00PM 5 15
Any help would be appreciated.
Thanks,
Assuming header is in Row 1, time column is column A, views column is column B, and you know for certain that there is one data entry for each hour -- that is, there are no time gaps in column A --
Enter the formula in cell C2: =OFFSET($B2,24*COLUMNS($B:B),0)
Drag the formula down from cell C2 to cell C25. Then drag the whole highlighted range, c2:c25, to the right until you start seeing zeros. Highlight cell B2 and drag to the right to autofill the header.

Frequency of data occurence in Excel Column based on the certain condition

I have a column (Table 1 below) with time data in 24 hour format saved as text.I want Table 2 to be populated by the hour and adding all the occurrences for the hour.
So one occurrence is at 0102. This falls within an hor range of 12:30am to 01:30pm. I want the count to be 1 for 01:00.
If an occurrence falls between 01:30 to 02:30 I want the count to be 1 for 02:00.
Also if time is 04:55 it should show count for 05:00 as 1. Basically rounding to the closest time and showing a count for that. It should round of to the nearest time and add the number of occurrences also. Thats why 06:00 is 2. to account for 0622 and 0614.
For example:
TABLE 1 TABLE2 (Expected results)
Column A Column A Column B
0102 01:00 1
0222 02:00 2
0223 03:00 0
0455 04:00 0
0622 05:00 1
0614 06:00 2
NOTE In B1 we get 1 because value in A1 of TABLE1 is 0102 and falls between 12:30 and 01:30, thus represented by 01:00 in A1 in TABLE 2. We have two values in Table1 between 01:30 and 02:30: one is in A2 and the second is in A3, so we expect 2 in B2 in TABLE 2, the time range which is represented by 02:00 in A2. We attribute 0 to cells B3 and B4 in Table2 because there isn't any data in Table1 between 02:30-03:30 and 03:30-04:30, therefore they get 0 in their corresponding cells in Table2. However, we have two instances of data, 0622 and 0612 in Table1 which fall between 05:30 and 06:30, so value 2 is attributed to B6.
How do I do this using a formula?
Please help.
So after struggling to understand what was going on, here is the simple solution:
first let me clarify again:
column A: but pasted as text originally and in hhmm format, but you need to reformat them as simple numbers, so you will lose those 0 s at the beginning of certain data.
column B: we put down our time ranges, as you said, starting from 12:30 AM, so i put it down as 0030 of which the zeros are not visible anymore in number format. This range starts from 30 and increments by 100, until it stops at 2330 instead of going to 2430. this will be reflected in the formula for the last cell in column D.
column C: the hour ranges against which we round and count the data in A.
column D: we put down the following formula in D2 :
=COUNTIFS(A:A,">"&$B2,A:A,"<"&$B3)
and drag and fill down until the last but one cell.
for the last cell D25 we change the greater/smaller than signs, and use the following formula (only for this cell):
=COUNTIFS(A:A,"<"&$B25,A:A,"<"&$B2)
Try these formulas, if it doesn't work, download the example sheet,
here is the example sheet i created for this purpose, downloadable from here
and if you still have questions, don't hesitate to put them in the commentaries.

Resources