selection of data from a data rows - excel

I got wind speed data in excel table like this:
(wind speed) (wind direction)
Year|month|day|00:00|06:00|12:00|18:00||00:00|06:00|12:00|18:00||X|
1966|01|01|5|12|6|8||60|360|270|50||X|
goal is to get in each day wind directin at wich was the max wind speed, for example: in firs jan. 1966 the max wind speed was 12 m/s at 06:00 and directon at the same time was 360. I need that 360 in next (X) column. If there is equal max wind speed in several observaton times then is no mater which of those directions put in at next column.
Is it poseble do it in MS excel? If someone can help me it would be so great!

Assuming the wind speed columns are D-G and the directions H-K then put the following formula in your column where the 'X' is (for row 2; copy it down the other rows)
=LOOKUP(MAX(D2:G2);D2:G2;H2:K2)

Related

Function for finding duration where wave height <3m where time is between 5:00am and 6:00PM

I am trying to find duration for time where wave height is under 3m and time period is between 5:00am and 6:00pm. Trying to find this duration for a month of tidal data.
I have raw data for wave height and timestamps when it is high and low.
eg.
Timestamp Wave_Height
1/01/2022 3:16 0.68
1/01/2022 9:37 6.62
1/01/2022 16:14 1.07
1/01/2022 21:54 5.37
2/01/2022 4:06 0.59
etc…
So far I have got linear interpolation to find points where wave height=3. I am struggling to get a function to find the durations for my limits on time.
Included a picture to explain
Graph of wave data over time
The timestamps occur over different days in the month so difference between times must consider the changed dates in some cases(see rev 2 errors ####### where errors occur for changing of dates)
rev 2 error
The following should work. I have added some columns to avoid complicated formulas.
interpolate when the wave_height = 3 (column G)
add column H which is True when wave_height increases and False if it decreases (at the time in column G):
so cell H6 = F7<3 gives TRUE
add column E to limit the time window to 5:00-18:00.
E7 is =IF(D7<$G$2;$G$2;IF(D7>$H$2;$H$2;D7))
Added column I to calculate the time during wich wave_height < 3. The sum of that column is what you need.
I8 is =H8*(G8-E7)+NOT(H8)*(D8-G8)

Find a temperature and work out how long it remained >= this temperature

I have an excel sheet with times in one column and temperatures in another. I'm trying to work out a formula that will find a certain temperature and measure how long it remained at that temperature.
11:25:29 AM 69.3°C
11:26:29 AM 69.6°C
11:27:29 AM 69.8°C
11:28:29 AM 70.0°C
11:29:29 AM 70.2°C
11:35:29 AM 70.8°C
11:36:29 AM 70.3°C
11:37:29 AM 69.5°C
11:38:29 AM 68.5°C
11:39:29 AM 67.5°C
12:39:29 PM 66.3°C
1:39:29 PM 52.1°C
2:39:29 PM 12.1°C
3:39:29 PM 5.0°C
In this example, I would like to find when it hit 70.0°C and how long it stayed above 70.0°C.
This is a bit of a tough problem because you might have multiple occasions where you go above 70 degrees. In that case, do you want the total time spent above 70 in the entire dataset, or do you want the total time spent above 70 consecutively? And then, how are you determining which of these potential multiple nonconsecutive periods you are talking about?
That said, you can try this. If column A is your datetime, and column B is your temp reading, specify another cell as your temperature reference value ($D$1 here), and in column C starting in row 2 do this:
=(A2-A1)*IF(B2>=$D$1,1,0)
and then copy that all the way down. What that does is it calculates the time difference between measurements and then if the temperature at that time is greater than your reference, it multiplies it by 1, otherwise it multiplies by 0. Because a date/time in Excel is really just a number, what you get is an interval of a day between measurements in each cell of column C. In other words, .25 = 6 hours.
Now that you have that data in column C, you are free to further parse it. You can use a simple SUM(C:C) formula in a cell, or you can go back and sum up individual ranges. I hope this helps.

Sum of Averages in Excel Pivot Table

I am measuring room utilization (time used/time available) from a data dump. Each row contains the available time for the day and the time used for a particular case.
The image is a simplified version of the data.
If you read the yellow and green highlights (Room 1):
In room 1, there are 200 available minutes on 1/1/2016.
Case 1 took 60 minutes, case 2 took 50 minutes.
There are 500 available minutes on 1/2/2016, and only one case occurred that day, using 350 minutes.
Room 1 utilization = (60 + 50 + 350)/(200 + 500)
The problem with summing the available time is that it double counts the 200 minutes for 1/1/2016, giving: Utilization = (60+50+350)/(200+200+500)
There are hundreds of rows in this data (and there will be multiple data dumps of differing #'s of rows) with multiple cases occurring each day.
I am trying to use a pivot table, but I cannot obtain the 'sum of averages' for a particular room (see image). I am using a macro to pull the numbers out of the grand total column.
Is this possible? Do you see another way to obtain utilization?
(note: there are lots of other columns in the data, like case start, case end, day of week, etc, that are not used in this calculation but are available)
The reason that you're getting 300 for both Average of Available Time columns is because the grand total is a grand total based on the overall average and not a sum of the averages.
Room 1: 200 + 200 + 500 / 3 = 300
Room 2: 300 + 300 + 300 / 3 = 300
I could not comment on the original question, so my solution is based on a few assumptions.
Assumption #1: The data will always be grouped. E.G. All cases in room 1 on a given day will grouped in sequential rows.
Assumption #2: The available time column is a single value for the whole day, there will never be differing available times on the same day.
Solution: Use column E as the Actual Available Time. This column will use a formula to determine if the current row has a unique combination (Date + Room + Available Time) to the previous and if so, the cell will contain that row's available time.
Formula to use in E2:
=IF(AND($A1 = $A2, $B1 = $B2, $C1 = $C2), 0, $C2)
Extend the formula as far down as necessary and then include the new column in your PivotTable data range.
End Result
I created a unique reference by combining columns and then used sumif/countif/countif.
So the formula in column E would be:
=sumif(colB,cellB,ColC)/Countif(colB,cellE)/Countif(colB,cellE)
Doesn't matter if the data is in order or not then.
Extend the formula as far down as necessary and then include the new column in your PivotTable data range.
The easiest method I would recommend is this.
=SUM(H:H)-GETPIVOTDATA("Average of Available Time",$G$3)
The first term sums the H column, and the second term subtracts the grand total value. It is a dynamic solution, and will change to fit the size of the pivot table.
My assumptions are that the Pivot Table was originally placed in cell G3.

How to make a "trending" or "averaging" curve

I have a spreadsheet on which I've been tracking my weight for the last year.
I weigh myself nearly every day, and I can be off by as much as 5 pounds from day to day.
I would like make a graph shows the overall pattern of my weight loss / gain, but without all of the noise.
What are some formulas that I can use to calculate the overall trend?
Place the raw daily measurements in A1 thru A365In B2 enter:
=(A1+A2+A3)/3
and copy down. Column B will give you a smoother dataset for plotting and trending.
Once you have enough data points a "moving average" will help reduce the daily noise. Let's say you have 10 data points starting in A1:
120.0 119.0 114.1 116.7 112.0 108.7 107.9 104.6 108.9 111.7
In cell C2 you could use the formula AVERAGE(A1:C1) and copy it to the end of your data set. THe relative references will always average the last 3 measurements.
Now your data looks like:
120.0 119.0 114.1 116.7 112.0 108.7 107.9 104.6 108.9 111.7
117.7 116.6 114.3 112.5 109.5 107.1 107.1 108.4
So your second row has far less variation that the raw data.
You can also get fancy and make the number of measurements variable. If that number were stored in A5 (below your data) then the formula would be something like
=AVERAGE(OFFSET(C1,0,0,1,-MIN(COLUMN(),$A$5)))
The MIN ensures that you don't go past the beginning of the data set (if you do a 5-day moving average you can;t go back 5 days from the 4th day, etc.)

Excel formula for an average where the price increases every day

Can some one help me with a simple forumla in excel for the following problem.
I need to be able to predict an average price for the month. For example, if the current price is $1000 and there are 5 days left until the end of the month, I believe the price will increase £50 p/day. 1050 then 1100 1150 etc So the average price for the last six days will be 1100?
i would like to be able to do a forumla that works it out from the current price, the increase amount and the days left with out having to have a cell for each day etc?
Is this possible? i have tried google but have come up with nothing, a difficult question to articulate.
Sounds like you're having troubles finding the days in the month and the percentage of the month that has already passed / left
To calculate the number of days in the current month use this formula
=EOMONTH(NOW(), 0)-EOMONTH(NOW(), -1)
To calculate the current day of the month use this formula
=DAY(NOW())
To calculate the percentage of the month already gone
=DAY(NOW()) / (EOMONTH(NOW(), 0)-EOMONTH(NOW(), -1))
To calculate the percentage of the month remaining
=1 - (DAY(NOW()) / (EOMONTH(NOW(), 0)-EOMONTH(NOW(), -1)))
I'm not clear what you are averaging - is it 5 days or 6?
If you start with 1000 and average 5 days then you are averaging 1000, 1050, 1100, 1150 and 1200 so the average is 1100 - if that's the required result try this formula
=A2+B2*(C2-1)/2
where A2 is price, B2 increase amount and C2 days left
If you are averaging 6 days then that starts at 1000 and ends at 1250 so average is 1125 and the formula should be:
=A2+B2*C2/2

Resources