I am having issues to get data from several time stamps into usable data.
I am trying to fill out a table which the first of every column is a month (January --> December) and the first of every row is an hour of day (00 --> 23).
The table is to be filled out by averaging data from another sheet which consists of a timestamp (i.e. 2011-01-01 0:00) and an amount (i.e. XXXX.XX).
My current logic is this:
Get Cell Number (i.e. B2)
Get Hour and Month allocated to cell (i.e. 00 and January)
Loop through data and Average data of said month and hour from other sheet excluding weekend days
Can anyone help me figure out the coding for this?
Need sample data and also what you have tried so far. You can achive the same using Countifs and sumifs.
So a given cells will be sumifs/countifs to get the average time for the given hour and for the given month.
To know more you can use excel help for the given formulas.
Related
I am using Microsoft Excel 2016 and I have a spreadsheet with multiple datasets that calculate a number of different things. For each site, we receive data for incremental reading throughout the whole year. This is for fifteen (15) sites, I am using one site for this description.
Once the incremental data is copied into the spreadsheet, a number of calculations exist. The following calculation summarizes the above-mentioned data to calculate the number of readings, column T in the image below, above a threshold, column U in the image below, that were taken over a single date.
=COUNTIFS(Regulator_7!$E$2:$E$100000,A2,Regulator_7!$C$2:$C$100000,U2)
Then the following calculation simplifies this, column V in the image below, to either a 1 or 0 using the following calculation.
=IF(T2>=1, "1", "0")
The 1 indicates an event happened on that date and the 0 indicates that no event happened on that date.
I now want to be able to summarize the number of events that happen in any given month. Here is the catch. If there is no event on the day before or the day after, it equates to a single event. If there are events on the before or the day after, the total number of events over multiple days equates to a single event. Therefore, January 1st, row 2, 5th, row 6, and 24th, row 25 would each be a single event. Calculating three (3) events in January. January 8th, row 9, 9th, row 10, and 10th, row 11 would need to be calculated as a single event rather the three (3) separate events. Therefore, there would be a total of four (4) events in January based upon the data I provided.
The following is the answer that worked for me from StackExchange SuperUser.
This counts where the dates fall in the month of January and the Regulator 7 Level is greater than or equal to 1 AND the next value is 0.
=COUNTIFS(A2:A1000,">=1/1/2019",A2:A1000,"<=1/31/2019",T2:T1000,">=1",T3:T1001,0)
Note the same size but offset ranges.
How to prepare an ageing report using SQL to identify how much payment has been due for
a. 90-120 days
b. 60-90 days
c. 30-60 days
d. 0-30 days
This should be calculated as on 6th April 2016.
Output should be like -
http://sqlfiddle.com/#!9/d83f4/1
Good question.
You would need to add a column or two in order for you to get this.
You'll need to have a calculated column letting you know the difference in days from today's date to the date of service/sale.
One more column is needed here, and that will "bucket" the record as per your pre-assigned buckets.
You can have a case statement do the work for each of these columns.
If you post some queries showing some work along these lines, we, at SO can help you along to correct your calculation.
I have a table in a data model that has forecast figures for the next 3 months. What I want to do is to show what the forecast number for the current month to date is.
When I use the DATESMTD function like this:
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),DATESMTD(DateTime[DateKey]))
I get the last month of my data summarised as a total. I assume that is because the DATESMTD function takes the last date in the column and that is 3 months away.
How do I make sure I get this current month MTD total rather then the end of the calendar? The formula should be clever enough to realise I am in May and want the May MTD not the August MTD.
Any ideas?
The way to do this is to do this:
Forecast_Transaction_MTD:=CALCULATE(sum('ATO Online'[2017 Transaction Forecast]), DATESINPERIOD('ATO Online'[Current Year],TODAY(),-day(TODAY()),day))
the last -day(TODAY()) gets the day number for the current day and subtract it from today's date. So, today is the 25 May. the -day(TODAY())),day)) extracts the day (25) and subtracts it from the current date to get me to the 1 May.
The rest of the formula just adds the total for the dates.
I would like to begin by saying I'm quite new to sql.
That said, here is my question/problem:
I have a view that has two date columns, a variable column and a text column (for comments).
I need to be able to split up all rows where the two dates are not in the same week. And I need to be able to split the variable value as well, so that it gets evenly distributed, based on how many days were in each week. The comment must be copied as well, so to be shown in each row.
My dataset looks like this:
DateIn DateOut Amount Comment
2014-11-01 2014-11-08 600 Good
And what I want is this:
DateIn DateOut Amount Comment
2014-11-01 2014-11-07 525 Good
2014-11-08 2014-11-08 75 Good
And if the time period spreads over more weeks, I would need it to split up to equivalent number of rows.
I would be very greatful if somebody could take the time to tell me how to achive my goal, using an sql-query.
As this is my first post on the forum, I apologize for any format errors in my post.
First, you need a weeks table. I mean physical table or view, where exists one row for every week possible. (We have dates table here, +/- 30 years from now - allows easily create weeks view and similar).
Then you need link your data to weeks table with left join; join condition should check date ranges overlap with week date range (probably you have to have both week start and week end fields in your weeks table - makes comparisons easier).
Then you need to divide amounts between weeks. Because you know date range length, week length and overlapping date range length, this should be trivial :)
I have a series of values (Column B) that have a timestamp (Column A) in hh:mm:ss: AM/PM format. What I am trying to do is average the values in Column B for every 10 minutes past in Column A. For example, I would need to average all the values in Column A from 12:40:00 PM - 12:50:00 PM in Column B. Ideally the code could scan through the entire dataset to produce these 10 minute averages.
Thanks in advance
You've tagged this as a vba question, but the result can be easily achieved with a formula.
If you are using Excel 2007 or later, use the AVERAGEIFS function
=AverageIfS(B:B,A:A,">="&<StartTime>,A:A,"<"&(<StartTime>+10/1440))
Replace <StartTime> with a reference to a cell containing the beginning of your 10min period.