I have to split up an excel vendor report with two thousand instances into a pivot table that displays instances that occured before 5PM, between 5-7PM and after 7 PM and I am stumped as how to do this. I tried adding another column with if and and functions to test where the time stamp falls within the given ranges but the only range that only pulls the before 5 PM category for some reason. Any suggestions?
You are right that you will need a helper column if you want your pivot table to be able to pull in the data. In the column to the right of your current data block, where I assume the timestamp is in column A, with a time/date format that Excel reads as such, try something like this (starting in the column to the right of your current data block, row 1 and dragged down):
=if(hour(A1)>19,"After 7PM",if(hour(A1)>17,"After 5PM, Before 7PM","Before 5PM"))
This will first check if it's after 7pm, and if it isn't it then checks if it's after 5pm, and if it isn't we know it's before 5pm.
If this doesn't work show us your data; my guess would be that your 'time stamp' isn't being read as a time stamp by Excel.
Related
hello dear forum members and admins,
i created a dashboard to calculate customer numbers based on raw data prepared on day and time set.
there is no problem here I can calculate. but I also want to calculate the monthly average customer numbers based on the time set. for this purpose, I created a data table in a daily_pax_sheet. for e.g in January between 10:00 - 10:30 CUSTOMERS E totally number is 35 and this 35 amount occurred in 8 days, then it calculates 4 amounts. in daily_pax_details sheet row 107 formula firstly calculate sum of the data then it divides the day number (for e.g this amount occurs in 8 days) but in some cases, raw data include more than 20k line and it's calculating and waiting too much. is there any other way to do it in a quick way ? how can I change this formula to make calculation quick ?
https://docs.google.com/spreadsheets/d/1y-2Ke2ssskzSM-wYszU54CIEraPbEX4X/edit#gid=459027650
UPDATE: thanks for the idea and solution from members
I also realized another solution and I think it will help other people in the future. we can get the data to the pivot table with counting the unique values with changing field settings. To do it you should get the data pivot table with selecting "add this data to the data model". then changing value field settings with the "Distinct value". hope it will help another pppl.
Your SUMIFS formulas use whole columns as criteria, so every calculation checks more than 1 million cells. And because you use more than 1 column, then every time you update *anything in the file, Excel checks more than 4 million cells because of your formulas...
I changed all to use the righ rawdata range of cells used, not whole columns. And now it works perfect.
As example, your formula is:
=SUMIFS('raw data'!$R:$R;'raw data'!$D:$D;'Daily customer'!C$3;'raw data'!$I:$I;'Daily customer'!$A4)
And I changed to:
=SUMIFS('raw data'!$R$2:$R$2461;'raw data'!$D$2:$D$2461;'Daily customer'!C$3;'raw data'!$I$2:$I$2461;'Daily customer'!$A4)
Because in your sheet raw data your data goes from row 2 to 2461, so in every calculation Excel checks only 2460 cells, not 1 million....
Change all your formulas like this and you should notice a better performance indeed.
UPDATE: I've uploaded the modified file: https://docs.google.com/spreadsheets/d/11isonBHFJTFFWtZTJg66JHbtyrD0XFGl/edit?usp=sharing&ouid=114417674018837700466&rtpof=true&sd=true
It works smoothly for me. No lag or anything. I can change any cell value, move the graph, filter cells and everything is done almost instantly.
I have a historical data set for commodity pricing. Throughout the data set, the data starts inputting prices on specific days, rather than the average of the entire month. In order to keep the flow of having only the average pricing for the months.
In the best case scenario, I would use an Averageif function, however, the data for each month doesn't display a consistent amount of days.
How can I automate this the process: If the month is the same as the previous row and different than the next row, calculate the average of the ^ rows until you hit the next month.
Here's a simple display of what I mean:
]1
You can use a pivot table to get the output you want. It will also be neatly organized instead of having your averages mixed in with a mostly blank column. Photo below shows the set-up/output of a pivot table generated with random data.
For a solution without pivot tables, you can use the following formula :
=AVERAGEIFS($B$1:$B$30;$A$1:$A$30;">="&(A1-DAY(A1)+1);$A$1:$A$30;"<="&EOMONTH(A1;0))
The above example is from cell C1, and can be copied down the entire list. The dates are in $A$1:$A$30 and the values in $B$1:$B$30. The first conditions test on the first day of the month (calculated as A1-DAY(A1)+1),and the second condition as last day of the month (calculated as EOMONTH(A1;0)
This will obviously put the average value of the month on each row, but will also work if your data is not sorted on date. If this is the case, and you only want to display one number per month in the column (as in your own example), you can add an additional IF statement wrapped around the formula:
=IF(EOMONTH(A2;0)=EOMONTH(A1;0);"";AVERAGEIFS($B$1:$B$30;$A$1:$A$30;">="&(A1-DAY(A1)+1);$A$1:$A$30;"<="&EOMONTH(A1;0)))
So it will display empty in all cells, except where the month changes.
In spreadsheet A, I have hourly data corresponding to a particular set of sample numbers (e.g. 1-10). Then I have 7 other data spreadsheets with 7 different time stamps (mm/dd/yyy hh:mm:ss) format. Out of 7, six spreadsheets have data every 2 minutes and the seventh has data every hour.
My objective is to match corresponding data values of 7 spreadsheets (1-7) with spreadsheet A and calculate the mean value of the data for each set of samples.
I have only basic knowledge of working with excel, so I first created a grand time stamp (called it as GTS, which has data entries every second) and then converted each entry of GTS and other time stamp entries into "serial date" format. I am trying to match these entries using functions like "IF", "Match" etc. but haven't found an appropriate method to execute it correctly.
Any advice would be appreciated. Thanks!
ok, i'm not exactly sure what you're trying to say but this is what i imagine,
Sheet 1 is your summary sheet, with column A having the times and data to the right. and sheets 2-7 with the source data in a similar set up.
1st question do you need all the data in 1 column or can you have 7 columns with the last one being the mean? if so then
=index(Sheet2!B:B,match(A2,Sheet2!A:A,0),0)
and sheet3 or whatever he sheet name is for the next column
or you can get creative and have the sheet names in the summary sheet as column headings then you can just do
=index(Indirect("B:$1"&"!B:B"),match(A2,Indirect("B:$1"&"!A:A"),0),0)
Also if the data isn't available for every time stamp then i'd add this around the formula to return 0s
=Iferror(......,0)
if you need to do all 6 source sheets in 1 cell then you gotta do some nesting
Good afternoon! I'm trying to get a Countifs or Index Match statement to count the number of times a value occurs in another table. The example:
On my report sheet, Column A contains 10 different statuses, such as Green, Yellow, Red etc.; Row 1 contains six dates, such as 1/31/2015, 2/28/2015, etc. These dates are calculations. The last date references my date worksheet and the five other use EOMONTH to get the month end for the five prior months.
On my data table, I have 7 descriptive columns (such as Type, Make, Model, etc) and then we begin date columns: 1/31/2010 all the way to 7/31/2015. I add a new column each month (I know, I don't like it either, but unfortunately we don't have a time series database).
What I need to do is have a Countifs or Index Match that pulls the date from my report tab, goes and finds it in the header row of my tblTrends, and then counts all those statuses that are Green, and if it's a SUV (for example).
Thoughts?
Thx!!
G
At it's most basic, you'd want something akin to:
=COUNTIFS(TypeRange,"SUV",FirstMonth,Status)
So let's say your data table starts in column L, and the first date column is O:
=COUNTIFS($L$1:$L$100,"SUV",O$1:O$100,A$2)
As you drag this formula across the different dates, it will move the date reference over one to the next month.
If you need it to dynamically determine the date column, I'd recommend OFFSET, which dynamically select a range. However, note that OFFSET is a "volatile" formula, which means it re-calculates anytime a change is made anywhere in the file, which can lead to pretty slow load times if not used sparingly.
=COUNTIFS($L$2:$L$100,"SUV",OFFSET($N$2:$N$100,,MATCH(B$1,$O$1:$Z$1,0)),$A2)
The OFFSET starts on column N, because that's the first column before the columns we want (the date columns). The MATCH tells it how many columns to OFFSET from here.
If you're going to use this over a large amount of data, then you could avoid using the OFFSET formula by creating a dynamic table. This table would only contain data for the six months you're interested in, by utilizing INDEX/MATCH, and you could run your COUNTIFS off this table, instead, using the original, basic method I first described. I can go into detail if you're unsure what I mean.
I have an Excel sheet connected to a txt file, with automatic refresh. I manage to get the data into the sheet. Below is an example of two rows:
1367945797 0,000 MainThread ---
1367945798 0,709 MainThread 200
The first column contains a unix timestamp, which Excel doesn't understand as a date/time info. I know I can convert the timestamp using the following formula:
=(((A1/60)/60)/24)+DATE(1970;1;1)
The second column contains a response time in ms.
The goal:
I want to count the number of rows where the time is:
Hour(formula_above) equals 16
, and calculate the average response time this hour
I'm trying to create a graph that shows the average response time for every hour in a day (1-24 hours).
It's important to note that I don't have an absolute range as new data is coming into the my data sheet.
I tried to use CountIF() but it doesn't look like it can calculate, and use the calculated value as if statement.
Any other ways of dealing with this issue?
Is there a simple function which itterates through the range (e.g: Sheet1!A:A) and gives me the value in each iteration, where I can return a value/boolean per iteration, and use countif or other formulas to do some magic stuff?
If your original timestamp is in column A you can use this array formula to average column B based on Hour 16 of column A
=AVERAGE(IF(HOUR(A:A/86400)=16;B:B))
confirmed with CTRL+SHIFT+ENTER
or you can pull the hour out using a helper column, e.g. in C2 copied down
=HOUR(A2/86400)
Then you can use AVERAGEIF like this
=AVERAGEIF(C:C;16;B:B)