I need to find out how many days (not times) when temperature have been below -15 degrees.
I have found data from a website that gives me the temperature every half hour but that gives me 48 values for each date.
If the temperature have been below -15 more than one time during the date it should only be counted as one.
Any ideas?
This is my data:
More example data
More example data
According to your sample image's columns, put this in an unused cell.
=SUMPRODUCT((D$2:D$999<=-15)/(COUNTIFS(B$2:B$999, B$2:B$999, D$2:D$999, "<=-15")+(D$2:D$999>-15)))
Adjust the rows to your actual data range to minimize calculating blank rows.
Related
I have a temperature data taken in every second (1Hz).
I want to reduce this data to minutes combined with averaging every 60 seconds of data. Which will be look like this.
I have tried moving average and other things but it didn't work. Is there any VBA code that i can approach my goal or any spesific function.
My time data range is [A3] - [A88739] and data range is [B3] to [B99739]
I will be waiting for your answers.
Thank you!
I think easier way would be using a helper column.
This will work only if your time data is always like the one you've posted and if the last 6 chars are .XXXXX where X can be letter or numbers, but leading dot is critical
My formula in column C is =VALUE(SUBSTITUTE(LEFT(A3;LEN(A3)-6);".";"/"))
Then with Pivot Table you can group your data by day,hour and minute, and get the average.
Setup of My Pivot Table:
Field Helper into rows section, and grouped by days, hours and minutes
Field Temp into values section, and choose average instead of sum up
I have minute data for air temperature and relative humidity (about 930,000 cells) for a building and I am trying to obtain the hourly average using excels "AverageIF" function. Here's the criteria that I have come up with: whenever one hour passes, average the air temperature and relative humidity for that hour. I am having trouble communicating these criteria to excel and any help would be appreciated. I have included a pic of what my data looks like:
the yellow row is me manually adding a row after an hour has passed and calculated the average using the average function.
In the example above I went a bit long winded in the formula to deal with time intervals where there was no data, as that generates a divide by 0 error.
Essentially what I did was setup a summary table to the right. I gave a start and end time for each hour (ASSUMING this is based on a 24 hour clock and not 1 hour from some arbitrary start time)
I used the AVERAGEIFS function as you have two criteria. Everything after a start time and everything before an end time. Only lines that match BOTH criteria are included.
The basic formula looks like this and is based on my example cell J4:
AVERAGEIFS(E$4:E$31,$C$4:$C$31,">="&$H4,$C$4:$C$31,"<="&$I4)
If the date is important, then you would need to add a date column to the table on the right and add a third criteria to the formula above.
In order to deal with divide by zero error and display blank instead of zero so you can distinguish between actual average of 0 and no data and still presenting an error when another type of error comes up I use the following formula in J4:
=IFERROR(AVERAGEIFS(E$4:E$31,$C$4:$C$31,">="&$H4,$C$4:$C$31,"<="&$I4),IF(ERROR.TYPE(AVERAGEIFS($E$4:$E$31,$C$4:$C$31,">="&$H4,$C$4:$C$31,"<="&$I4))=2,"","ERROR"))
The above formulas can be copied down and to the right.
I run a test overnight and have the results written on a txt file that I later extract the time and value from. The result is something like this:
Time data
Because it goes overnight and the time resets, the resulting plot is this:
Out of order plot
Is there any way to force the order in which the values are plotted without modifying the original .txt file so that it looks like my daytime tests?
in order plot
Edit:
Indeed the actual data skips and the timestamps are not periodic, here's how it looks around midnight
Not periodic timestamps
You will need a helper column and you need to make sure your time is actual excel time, and not a time string. Assuming your time is in column B starting in cell B2 you can use the following process:
1) Test cell
=ISNUMBER(B2)
If that is TRUE then you know you have your time stored in excel format. In excel time is stores as a decimal which represents the portion of a day. 12 noon is 0.5. Dates are stored as integers and represent number of days since 1900/01/01 with that date being day 1.
2) Add 24 hour increment
In order to properly sort your order for graphing purposes, you will need to add a day everytime your data passes the 24 / midnight mark. Assuming your data is sorted chronologically as per your example, use the following formulas in lets say column C
First cell C2
=B2
In C3 and copy down
=IF(B2>B3, B3+1,B3)
which can be rewritten as
=B3+(B2>B3)
Now format the cells in C for time. The date will not display, only time will. The times after the 23:59:59 mark will all be the following day.
I am working with a weather data set. I am particularly interested in two columns which are cumulative precipitation and a date. My question is a simple one, though I am struggling to figure out the solution. Essentially I am wanting to determine days since precipitation. An example of the data is as follows:
WEATHER DATA
Pr Date
40 8/8/2013
40 8/8/2013
40 8/9/2013
40 8/9/2013
41 8/10/2013
41 8/10/2013
In this example, if I know the last day it rained was 8/7, then 8/8 would have a value of 1 (days since precipitation), 8/9 would be 2, and 8/10 would go back to 0. I have multiple dates because of hourly recordings (I trimmed it down for this post). I've been trying to figure it out with conditional if|then statements, but I'm thinking VBA may be more appropriate here. Any help or insight would be greatly appreciated.
Assuming cell C2 to be equal 1 (or start where you wish by adjusting the C2 value), the formula below works in the example you provided. Type in C3:
=IF(A3<>A2,0,IF(B3=B2,C2,1+C2))
Drag the formula down. Explanation:
If precipitation from time i+next is different from i it comes back to zero --> there was rain.
If time i+next is equal i, then it compares the date d+next with d.
If they are equal hold the number of days without rain from previous cell.
If they are not, add 1 day* to the value inside previous cell.
*I'm assuming you have consecutive days from the following sentence:
I have multiple dates because of hourly recordings
In the attached excel file
http://www.sendspace.com/file/y9qj0t
I've got a time period "C3:D3" (time periods can be altered by user) and a sum of money for which i need to calculate interest across different time periods with different interest rates.
You can check out my formula in "E6:E" but somehow I'm not postive it's correct.
I want the formula to divide days of the above period of time across the different int. rates time frames & return "0" when int.rates times frames are before or after my time period.
Also, I'm not certain how to handle the last int. rate time frame (ie the last time int. rate was changed so it's not a closed time frame B50:C50). B50 is occupied by the last date int. rate was changed and C50 equals above mentioned D3. Does it make any sense?
Thanks for any help!
I was going to answer your previous question....but you deleted it...
Your method works, I think, but this formula can give you the correct result in a single cell without using columns E and F
=SUMPRODUCT(LOOKUP(ROW(INDIRECT(C3&":"&D3-1)),B6:D50))/365*E3
it doesn't matter what value you put in C50
The ROW/INDIRECT part gives you an "array" of all dates from C3 to D3-1 and that array is the lookup value for LOOKUP function, looking up each date in B6:B50 and returning the corresponding rate from D6:D50. SUMPRODUCT then sums all those rates. Diving by 365 then gives you the average annual rate. I get 2.89 for your example, the same as your result